As said in the in the title, I want to change default error pages in tomcat and did:
<error-page>
<error-code>500</error-code>
<location>/error_500.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error_404.html</location>
</error-page>
Is it possible to use wildcard error codes like
<error-page>
<error-code>*</error-code>
<location>/error.html</location>
</error-page>
?
(The example above doesn't work, but is there another way?)
Thanks
No, there is no way in Tomcat.
The Servlet 3.0 specification supports a global error page as follows:
<error-page>
<location>/error.html</location>
</error-page>
So in theory it should work in at least Tomcat 7.0. But it's not properly implemented in Tomcat 7.0. I have ever reported issue 52135 about this, but they denied it. It works on other Servlet 3.0 containers though.
You can however workaround this by implementing a Tomcat-specific ErrorReportValve
class which you then register as <Host errorReportValveClass>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With