delvedor / hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!
MIT License
182 stars 36 forks source link

Allow client to push custom headers in connect request #8

Closed kamilikamil closed 2 years ago

kamilikamil commented 4 years ago

I think it would be nice to allow the client to pass custom headers which are then sent to proxies in the connect request

mbargiel commented 2 years ago

I know this is an old, stale PR, but I recommend closing it. Typically, you should not blindly send headers intended for the upstream server in the proxy CONNECT request. Some headers may include sensitive information and need to be sent only over an encrypted connection, such as Authorization - not to mention that the proxy itself has no use for that header. Other headers can cause interference, like including the Content-Type and Content-Length headers from the upstream request with the CONNECT request.

Instead I would recommend looking at PR #72, which adds support for explicitly setting request options specifically for the CONNECT request; that includes passing custom headers to the proxy server without including them in the upstream request (and vice versa).