Open the network panel, click httpxy and http-proxy buttons to both fetch https://baidu.com (the Chinese largest search engine, I just use it as an example).
httpxy response with a 405(❌), and the http-proxy response with a 302(✅).
I have verified it's the Host that caused the wrong response(maybe some check by baidu.com),
When using httpxy, the request Host is baidu.com:443
Environment
nodejs: v20.12.0 httpxy: v0.1.5(latest)
Reproduction
stackblitz - reporduciton
You have to download this project to run locally (Some TLS error prevents it from running in Stackblitz).
Describe the bug
/api/httpxy
is usinghttpxy
(this repo)/api/http-proxy
is using node-http-proxyhttpxy
andhttp-proxy
buttons to both fetch https://baidu.com (the Chinese largest search engine, I just use it as an example).httpxy
response with a405
(❌), and thehttp-proxy
response with a302
(✅).I have verified it's the
Host
that caused the wrong response(maybe some check by baidu.com),httpxy
, the requestHost
isbaidu.com:443
Caused by this:
https://github.com/unjs/httpxy/blob/07778fb8984c7f63d5cd00e38b787e7da27209fc/src/_utils.ts#L108-L110
http-proxy
, the requestHost
isbaidu.com
I'm not saying Baidu's strategy in the response, I just wonder why we add the
port
to theHost
, it might break some other sites as well.Sorry to disturb if anything I misunderstood ❤️.
Additional context
No response
Logs
No response