How to configure Apache to act as an SSL proxy to an application server?

Solution 1:

If Tomcat runs on the standart ports (8080 - HTTP, 8009 - AJP) add this to yours Apache configuration:

<VirtualHost _default_:443>
    .......
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    <Location /app>
        ProxyPass        ajp://localhost:8009/app
        ProxyPassReverse ajp://localhost:8009/app
    </Location>

    #<Location /app>
    #    ProxyPass        http://localhost:8080/app
    #    ProxyPassReverse http://localhost:8080/app
    #</Location>

    <Location "/app/WEB-INF/">
        deny from all
    </Location>    
   ..........
</VirtualHost>

<VirtualHost *:80>
   ...........
    RewriteEngine On
    RewriteRule ^/app$  https://%{HTTP_HOST}%{REQUEST_URI} [R]
   ...........
</VirtualHost>