From 351de86a26c84b24eb3756cffa0de0a8dedab3c6 Mon Sep 17 00:00:00 2001 From: Umputun Date: Fri, 15 Mar 2024 17:32:33 -0500 Subject: [PATCH] move setting X-Forward-URL after both scheme and host set --- app/proxy/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/proxy/proxy.go b/app/proxy/proxy.go index 1c42f26..03edeb9 100644 --- a/app/proxy/proxy.go +++ b/app/proxy/proxy.go @@ -212,7 +212,6 @@ func (h *Http) proxyHandler() http.HandlerFunc { uu := ctx.Value(ctxURL).(*url.URL) keepHost := ctx.Value(ctxKeepHost).(bool) r.Header.Add("X-Forwarded-Host", r.Host) - r.Header.Set("X-Forwarded-URL", r.URL.String()) if h.SSLConfig.SSLMode == SSLAuto || h.SSLConfig.SSLMode == SSLStatic { h.setHeaderIfNotExists(r, "X-Forwarded-Proto", "https") h.setHeaderIfNotExists(r, "X-Forwarded-Port", "443") @@ -224,6 +223,7 @@ func (h *Http) proxyHandler() http.HandlerFunc { if !keepHost { r.Host = uu.Host } + r.Header.Set("X-Forwarded-URL", r.URL.String()) h.setXRealIP(r) }, Transport: &http.Transport{