kiwisan kiwisan - 5 months ago 40
Apache Configuration Question

What's the best way to redirect a Tomcat 404 URL with Apache as front-end?

I have Apache 2.4 forwarding *:80 traffic to my sole Tomcat 7.0 webapp (Guacamole) like so:

ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:8080/guacamole/
ProxyPassReverse / http:/localhost:8080/guacamole/
ProxyPassReverseCookiePath / http://localhost:8080/guacamole

This works, except when I log out of the webapp, I get the following 404 as reported by Tomcat:

HTTP Status 404 - /guacamole/guacamole/index.xhtml

From what I've read I've got several options, including using ProxyPass/redirect, rewrite, VirtualHost, and symlinks. Some of these options are possible under both Apache and Tomcat configs. I'm confused. What's the best method to ensure
(or *) requests get to to

(I know no Java if the actual root cause is in the Guacamole webapp code.)


To anyone who stumbles across this issue, I was able to resolve from Suresh Atta's answer to this question.

Basically all that I had to do was create a custom 404 html in /var/lib/tomcat/webapps/guacamole/logout.html which contains a polite message and invitation to log in again:

<h2 align=center>Thank you. You're now logged out.</h2>
<h2 align=center>If this was a mistake or you'd like to begin a new session, 
please <a href="">click here.</a></h2>

And then I added this directive to web.xml:


I'm sure there's a little cleaner way to do this, but the requirements are low for this right now, and this smoothed the rough edge.