Open doggy opened 5 days ago
Maybe we need to add a new option for this, since this is the default behavior of hysteria2: https://github.com/apernet/hysteria/blob/15e31d48a09af0835773bd5c62cedbb3fc0e351d/app/cmd/server.go#L815
Maybe we need to add a new option for this, since this is the default behavior of hysteria2: https://github.com/apernet/hysteria/blob/15e31d48a09af0835773bd5c62cedbb3fc0e351d/app/cmd/server.go#L815
Thank you for mentioning this code. It’s weird that the default settings for HTTPS masquerade do not work with the most popular websites like bing, yelp..
This PR updates the masquerade
option style to include support for rewriteHost
and making it more similar to Hysteria2.
It also retains support for the previous Sing-Box style for better understanding among existing users.
Docs and unit test updated also
Removed
r.Out.Host = r.In.Host
to resolve an issue where the proxy was incorrectly using the client's host header instead of the target's host. This ensures the proxy request aligns with the intended masquerade behavior.API Document
https://pkg.go.dev/net/http/httputil#ProxyRequest.SetURL
Currently the code line
r.Out.Host = r.In.Host
is used forpreserve the inbound request's Host header
which is sing-box server's host name in our situation.Sample Code
A go proxy sample here for occurring this bug:
The bad result:
After removed
r.Out.Host = r.In.Host
, it seems works properly.