From b45493f38a136753157dbe769a8642e2215bcdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Urban?= Date: Mon, 16 Oct 2023 20:49:27 +0200 Subject: [PATCH] fix(backend): improve extract domain function --- backend/internal/handlers/auth.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/internal/handlers/auth.go b/backend/internal/handlers/auth.go index 6fea815..f835429 100644 --- a/backend/internal/handlers/auth.go +++ b/backend/internal/handlers/auth.go @@ -266,17 +266,17 @@ func (h *Handler) getRedirectFromCookie(r *http.Request, w http.ResponseWriter) } func (h *Handler) getRedirectUrl(r *http.Request) (string, error) { // Extract the redirect parameter from the request to get the site URL. + printHeaders(r) siteURL := r.Header.Get("X-Forwarded-Uri") if siteURL == "" { siteURL = r.Header.Get("Referer") - } - if siteURL == "" { - siteURL = r.URL.Query().Get("redirect") - } - if siteURL == "" { - printHeaders(r) - return "", fmt.Errorf("Redirect URL missing from both header and URL parameter") + if siteURL == "" { + siteURL = r.URL.Query().Get("redirect") + if siteURL == "" { + return "", fmt.Errorf("Redirect URL missing from both header and URL parameter") + } + } } return siteURL, nil }