Apache as reverse proxy

The apache httpd server can be used as a reverve proxy, allowing to benefit from all the apache good stuff, while using an external app to provide a service.

  1. Enable proxy_http:
a2enmod proxy_http
  1. Configure apache

    You can define a dedicated vhost:

    <VirtualHost *:80>
        ServerName pad
        ServerAdmin admin@pad
    
        ErrorLog    /var/log/apache2/pad.error.log
        CustomLog   /var/log/apache2/pad.access.log combined
    
        # authentication setup
        <Location />
            AuthType Basic
            AuthName "Login"
            AuthUserFile "/etc/apache2/users.passwd"
            Require valid-user
        </Location>
    
        # reverse proxy setup
        ProxyRequests Off
        ProxyPass / http:// localhost:9001/
        ProxyPassReverse / http:// localhost:9001/
        ProxyPreserveHost on
        <Proxy *>
            Options FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Proxy>
    </VirtualHost>
    

    Or you can use a Location directive:

    [...]
    ProxyRequests Off
    ProxyPass /pad/ http:// localhost:9001/
    ProxyPassReverse /pad/ http:// localhost:9001/
    ProxyPreserveHost on
    <Proxy *>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Proxy>
    [...]