apachetomcatforwardwebmailajp

Apache forward everything to Tomcat except webmail


I have my Apache HTTP server set up to forward all requests to Tomcat, i.e. proxy_ajp.conf looks like:

ProxyPass / ajp://localhost:8009/

where Tomcat is listening on port 8009. This works find except when I try to access squirrelmail (i.e. webmail) on the server. Is there a way to forward all requests to Tomcat except those going to /webmail/?

Thanks for the help.


Solution

  • This is really more of a serverfault sort of a question, but yes, you can do it.

    You need to use a RewriteRule, something like this:

    RewriteEngine On
    RewriteCond REQUEST_URI !^/webmail.*
    RewriteRule / /tomcat/
    
    <Location /tomcat>
         ProxyPass ajp://localhost:8099/
    </Location>