http-party / node-http-proxy

A full-featured http proxy for node.js
https://github.com/http-party/node-http-proxy
Other
13.95k stars 1.98k forks source link

option.xfwd - add header "X-Forwarded-Host" #886

Open chimurai opened 9 years ago

chimurai commented 9 years ago

Should X-Forwarded-Host be added when xfwd is set to true?

Current x-forwarded-* fields:

x-forwarded-port is probably redundant as x-forwarded-host includes the port number. See Wikipedia

Implementation of xfwd code

stokito commented 7 years ago

Should X-Forwarded-Host be added when xfwd is set to true?

Forwarding for web is actually adds the x-forwarded-host header https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy/passes/web-incoming.js#L56 I'm not sure but it looks like forwarding of WS should work in the same manner.

x-forwarded-port is probably redundant as x-forwarded-host includes the port number

Yes, your right, I read a spec and it says that X-Forwarded-Host is exactly the same as original Host header and it MAY contain a port number