Search code examples
proxyreverse-proxytunneltunneling

How to use forward proxy for HTTPS?


I have a use case where I have to put a middle server or relay or tunnel to do network communication with the following points:

  • I have a web server running, let say when I hit an API /request hosted my web server, it creates a post request to https://www.google.com and gives me a response through the endpoint.
  • I want a middle server (proxy etc.) which I will call while creating this post request instead of communicating through my webserver,
  • the call goes to the middle server and gives me the same response as I was getting directly.

Solution

  • For this, the SQUID proxy worked for me.

    I came across NGINX, but we can not use NGINX as a forward proxy, also there are some observations that might be useful with this regard.

    • SQUID proxy also uses the conf file as similar to NGINX,
    • HTTPS traffic is encrypted, the proxy server need to do some more work to get something with Https requests,
    • For intercepting, and creating ACL rules, someone will need to have a dummy certificate to be used by the server to act as the owner of the requested content through the proxy,
    • a list of rules can be incorporated within SQUID.conf to achieve the filtering.

    I hope this could be useful to achieve something like this.