We have setup like this:
httpd <-> mod_jk (Tomcat)
httpd is configured to forward all request to URL /app* to mod_jk. httpd is configured with custom error pages for HTTP errors 404, 500 etc.
If user enters URL, http://hostname/non-existing-page
- then httpd's custom 404 error page is displayed.
If user enters URL, http://hostname/app-blabblah
- then, Tomcat's 404 error page is displayed. The application hosted at /app can deal with 404 errors if it is something like /app/non-existentpage. But context /app-blablah does not resolve to any war file on Tomcat, and hence results in Tomcat's 404 error page.
We are using stripped down version of Tomcat, its webapps folder has only app.war
.
I have been asked to not display Tomcat 404 error page as it reveals the fact that app is hosted on Tomcat and also displays Tomcat's version.
If anyone can tell me how to:
- Add custom 404 error page for Tomcat when it has to deal with URLs that represents non-existing context.
- Or configure httpd such that if it sees that Tomcat is returning 404 error, it renders its own custom 404 error page.
PS: I am not at liberty to point only /app/* to mod_jk, as we sometimes deploy other wars that start with app for debugging purposes - for e.g. app-debug.war.
Update: I am changing mod_jk workers.properties to forward only /app/* to Tomcat.