node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

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

Open chimurai opened this issue 10 years ago • 2 comments

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

Current x-forwarded-* fields:

  • x-forwarded-for
  • x-forwarded-port
  • x-forwarded-proto

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

Implementation of xfwd code

chimurai avatar Sep 24 '15 15:09 chimurai

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

stokito avatar Oct 25 '17 23:10 stokito

Yes it seems this does works for web, but not for ws.

markmaker avatar May 19 '25 09:05 markmaker