Suppress Tomcat error pages using Nginx
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 (Tomcat) .
Having the same problem here
I'm trying to do the same thing. Tomcat is a web application server so it's not is job to serve static error pages. I'm trying to make nginx serve the messages returned by tomcat with no success.
Any clue of how to do it? Any http server configuration is a starting point I think.
Yep, found it:
|All times are GMT -5. The time now is 12:58 PM.|