Closed mmmray closed 2 weeks ago
https://www.v2fly.org/en_US/v5/config/stream/websocket.html https://www.v2fly.org/en_US/v5/config/stream/httpupgrade.html
If people who call themselves developers cannot do basic things like generate different json for different transports, then we will not provide any support.
I feel that the experience for direct core users is also affected. Fixing this will not just help GUI, it will help everyone.
In general, sing-box seems to have much cleaner config format than other cores. But somehow this inconsistency is OK?
Nobody is asking for free work to support Hiddify here, that's why PR was filed.
Operating system
Ubuntu 22
System version
Ubuntu 22
Installation type
Original sing-box Command Line
If you are using a graphical client, please provide the version of the client.
No response
Version
Description
the configuration
{"headers": {"Host": "example.com"}}
does not have the desired effect on httpupgrade, but does work on websocket. httpupgrade falls back to theaddress
for theHost
header even if thehost
header is explicitly provided as shown.the configuration
{"host": "example.com"}
does not work on websocket, but does work on httpupgrade, as websocket does not have ahost
field to begin with.the configuration
{"headers": {"host": "example.com"}}
(lowercase host) in httpupgrade will produce duplicate host headers, which is definitely not desirable.I suggest to make the behavior consistent across transports, or maybe even consistent with xray. It could be considered intended behavior, but it feels like a footgun.
it seems some GUI authors got confused by this, and as a result their
host
setting forhttpupgrade
does not work, as it produces config forhttpupgrade
like{"headers": {"host": "example.com"}}
. this was probably copypasted from their code for websocket.credit goes to @mikeesierrah for discovering and debugging
Reproduction
it is not necessary to provide a server config, as the issue is purely within the request headers. the above config can be launched with
./sing-box run -c config.json
as-is, andcurl -x socks5h://127.0.0.1:2080
will trigger the handshake.Then, wireshark can be used to observe the result:
Host: example.com
is expected instead of speedtest. It can be fixed by changing"headers": {"Host": ...}
to"host": ...
Logs
Supporter
Integrity requirements