views:

23

answers:

1

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.

+1  A: 

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>
easel
I'm getting an error when restarting apache that says ProxyPass can't have a path when defined in a location. Any work around?
Joe
See the edited version. There is only 1 param to proxypass when it's in a location.
easel
Thanks. That helped. It looks like the rewrite rule isn't working though. I can go to /webmail and see the squirrelmail page, but I can't go to my Tomcat app unless I explicitly type /tomcat/. Any help is appreciated.
Joe
I probably screwed up the syntax a bit. Turn on rewrite logging and see what it says. Try adding a "." before the * after webmail, too.
easel
Another solution is to add this: "ProxyPass /webmail !" before the original ProxyPass.
Joe