How to route Apache ProxyPass configuration through another proxy server? (Proxy to proxy)
Sometimes we do configure forward proxy (ex: Squid Proxy) behind Apache server. This page help us to understand
how to configure ProxyPass configurations within Apache httpd.conf file.
Incase if we want to route our requests through proxy from within Apache, then you need to add ProxyRemote
under your VirtualHost configurations as shown below:
<VirtualHost example.com:443>
SSLEngine on
[cert file config]
ServerName example.com
...
...
...
ProxyRemote * http://myproxyhost.com:3128
ProxyPass /myapp/ http://testapp.com/myapp/
</VirtualHost>
|
As per the Apache documentation, ProxyRemote defines remote proxies to this proxy. The syntax is:
ProxyRemote match remote-server
match is either the name of a URL-scheme that the remote server supports, or a partial URL for which the remote
server should be used, or * to indicate the server should be contacted for all requests. remote-server is a partial URL for the
remote server.
Here is some examples:
Example |
ProxyRemote "http://goodguys.example.com/" "http://mirrorguys.example.com:8000"
ProxyRemote "*" "http://cleverproxy.localdomain"
ProxyRemote "ftp" "http://ftpproxy.mydomain:8080"
|
|