From c7176844419ef3d1a45c7002a35ec54cdf5b981f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Urban?= Date: Mon, 16 Oct 2023 20:01:12 +0200 Subject: [PATCH] fix(backend): add header logging for debug --- backend/internal/handlers/auth.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/internal/handlers/auth.go b/backend/internal/handlers/auth.go index 0422aa7..9722eea 100644 --- a/backend/internal/handlers/auth.go +++ b/backend/internal/handlers/auth.go @@ -266,6 +266,7 @@ 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.URL.Query().Get("redirect") @@ -275,3 +276,11 @@ func (h *Handler) getRedirectUrl(r *http.Request) (string, error) { } return siteURL, nil } +func printHeaders(r *http.Request) { + for name, values := range r.Header { + // Loop over all values for the name. + for _, value := range values { + fmt.Printf("%s: %s\n", name, value) + } + } +}