Proxy Server Headers over HTTPS

If you send most of your proxy server requests over HTTPS, custom headers for controlling the IP address need to be transmitted in a special way that enables the proxy server to read it. That's because normal request headers are encrypted when sent through the proxy, and custom proxy server headers are not natively supported by most client libraries.

Below is a general method for handling custom proxy server headers. With it, you hook into the socket as soon as you've made the initial CONNECT. The method involves these basic steps:

  • Open the socket directly in your code.
  • Send the initial CONNECT string, with optional custom proxy server headers.
  • Read the initial response to get the X-ProxyMesh-IP header.
  • Then continue with the normal request headers and response. Depending on your client library, you may be able to pass the socket to the library in such a way that you can use the library as normal to complete the request.

Please see also Proxy Server Request & Response Headers.

An easier alternative is available if your request library can pass Authentication headers to the proxy server for HTTPS requests. This alternative is to specify a unique string in the Authentication header, in order to use a specific IP address. You'll find details in Controlling IP Addresses of Requests.

Still need help? Contact Us Contact Us