Correct Host header for proxy tunnel CONNECT #374

merged 1 commit into from Nov 19, 2012


None yet

2 participants


As per RFC 2817, section 5.2 Requesting a Tunnel with CONNECT, there is a Host header to be set. The examples in the RFC use the same example host/port which is confusing, but logically, it makes no sense to use the same hostname in CONNECT statement and in the Host header. The Host header is meant to be set to the actual host to be proxied/tunelled to, and it looks like at least some of the proxies out there work that way.

I believe this also closes #367.


  1. it would probably be ideal if the tunnel options were overridable from the main api, e.g. via opts = { tunnelOptions: { .. } }
  2. it would probably be better if the Host header for the tunnel was set after the logic for resolving the target hostname/port/protocol, which is below the tunnel config code, but it contains a few references to self.tunnel, so I'm not sure on that.

The change in test-tunnel.js is to support Squid 3.

@mikeal mikeal merged commit 82d3cb1 into request:master Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment