Resources for Apache Reverse Proxy

Sample configuration

Listen 80
NameVirtualHost *:80

#Repeat below section for each proxy
<VirtualHost *:80>
    ServerAdmin someone@example.com
    DocumentRoot /var/www/html
    ServerName abc.xyz.example.com
    ServerAlias yyy.example.com

    # mod_proxy setup.
    ProxyPreserveHost On
    RequestHeader unset Authorization
    ProxyRequests Off
    ProxyPass /  http://somelocalserver:7503/
    ProxyPassReverse /  http://somelocalserver:7503/
    <Proxy *>
       Order deny,allow
       Allow from all
    </Proxy>
    ErrorLog logs/somelocalserver-7503-error_log
    CustomLog logs/somelocalserver-7503-access_log common
</VirtualHost>

Sample configuration - yahoo

Below is a sample to show how apache redirects traffic to www.yahoo.com when accessing your apache server using reverse proxy. However any links on the page will redirect to yahoo directly in this example.

    <Location />
        ProxyPass http://www.yahoo.com
        ProxyPassReverse http://www.yahoo.com
        Order allow,deny
        allow from all
    </Location>

Another example - shellinabox

Here all access to the said apache URL will redirect to localhost port 4200. This is useful to not have to open an additional port to serve out another service but access everything from apache (port 80, if so configured) by configuring a virtual apache host. Some services don't require ProxyPassReverse setting as there are no links to click on the target. This particular configuration was used to run shellinabox access over apache. Related topic: Startup script for shellinabox

    <Location />
        ProxyPass http://localhost:4200/
        Order allow,deny
        allow from all
    </Location>

QR Code
QR Code tech:apache:apache_reverse_proxy (generated for current page)