From 4f91c7227ee19b3b434311f24d299fbd0cea5d56 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 30 Mar 2026 00:24:34 +0700 Subject: [PATCH] Clear RequestURI in reverse proxy to prevent client RoundTrip rejection. Updated reverse.go to ensure that server-side requests do not carry RequestURI, enhancing compatibility with client requests. --- internal/proxy/reverse.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/proxy/reverse.go b/internal/proxy/reverse.go index c210c1b..f140f80 100644 --- a/internal/proxy/reverse.go +++ b/internal/proxy/reverse.go @@ -21,6 +21,8 @@ func NewReverseProxy(target *url.URL, stripPrefix, pathPrefix string, setAuth st if setAuth != "" { req.Header.Set("Authorization", setAuth) } + // Server-side requests carry RequestURI; client RoundTrip rejects it with URL.Host set. + req.RequestURI = "" return } rest := strings.TrimPrefix(p, stripPrefix) @@ -41,6 +43,7 @@ func NewReverseProxy(target *url.URL, stripPrefix, pathPrefix string, setAuth st if setAuth != "" { req.Header.Set("Authorization", setAuth) } + req.RequestURI = "" } return proxy }