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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user