Search code examples
apachereverse-proxymod-proxyhttp-proxy

How to reverse proxy a host with apache that is behind a forward proxy


If you have a host that is only reachable through a forward proxy and wish to access it through an application, that does not support proxies - how do you set up an reverse proxy in a virtual host of an apache, which is reachable by the application?

That is, the application accesses http://myapache:myvirtualhost/ , from which myapache accesses the remote application by forwardproxy:forwardport .


Solution

  • One way to do this is to set up the apache on myapache with:

    Listen 12345
    
    <VirtualHost *:12345>
      ProxyRemote http http://forwardproxy:5432
      <Location />
          ProxyPass http://remoteapp:9876/
          ProxyPassReverse /
      </Location>
    </VirtualHost>
    

    The remote application http://remoteapp:9876/ is reverse-proxied as http://myapache:12345 . If something connects http://myapache:12345 , the request is proxied by http://forwardproxy:5432