fix wrong url passed

This commit is contained in:
yusing 2024-03-07 05:20:17 +08:00
parent 71cd2f3948
commit 303a0cce02
2 changed files with 3 additions and 3 deletions

Binary file not shown.

View file

@ -49,11 +49,11 @@ func NewHTTPRoute(config *ProxyConfig) (*HTTPRoute, error) {
PathMode: config.PathMode, PathMode: config.PathMode,
} }
director := proxy.Director
proxy.Director = nil proxy.Director = nil
initRewrite := func(pr *httputil.ProxyRequest) { initRewrite := func(pr *httputil.ProxyRequest) {
pr.SetURL(url) director(pr.Out)
pr.SetXForwarded()
} }
rewrite := initRewrite rewrite := initRewrite
@ -78,7 +78,7 @@ func NewHTTPRoute(config *ProxyConfig) (*HTTPRoute, error) {
} }
// disable cache // disable cache
r.Header.Set("Cache-Control", "no-store") r.Header.Set("Cache-Control", "no-store")
var err error = nil var err error = nil
switch { switch {
case strings.HasPrefix(contentType[0], "text/html"): case strings.HasPrefix(contentType[0], "text/html"):