Fix hysteria2 masquerade bug: Ensure proxy request uses target host

This commit is contained in:
dou 2024-11-21 01:45:45 +08:00
parent 013a69c002
commit 3fe0318c75

View file

@ -72,7 +72,6 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
masqueradeHandler = &httputil.ReverseProxy{ masqueradeHandler = &httputil.ReverseProxy{
Rewrite: func(r *httputil.ProxyRequest) { Rewrite: func(r *httputil.ProxyRequest) {
r.SetURL(masqueradeURL) r.SetURL(masqueradeURL)
r.Out.Host = r.In.Host
}, },
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) { ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {
w.WriteHeader(http.StatusBadGateway) w.WriteHeader(http.StatusBadGateway)