As known to most of us, Tomcat's error pages can be altered using the <error-page>...</error-page> tag in web.xml. However, in my case, everything works fine except the most frequently observed 404 Not Found page. Also, these error-page configurations won't work if the webapp is unavailable or undeployed.
As a solution, I have thought about having these error codes relayed back to Nginx while proxying (or reverse proxying). Further, setting error handlers with error_page directive would only be a piece of cake.
However, even after adding the error_page directives, the Tomcat errors are visible. Something like http://mydomain.com/anybaduristring
should go to Nginx's 404 handler but in my case, it shows Tomcat's default "404 Resource unavailable" page.
I'm on Nginx 0.7.64 and 0.6.32 along with Apache Tomcat 6.0.18 . All requests for http://mydomain.com
are proxied transparently to http://localhost:8080