How to customize an error response for an invalid request accessing "/META-INF/" or "/WEB-INF/..." of web application on JBoss EAP 7
Issue
When I send an invalid request accessing "/META-INF/" or "/WEB-INF/..." of web applications on JBoss EAP 7, it returns the following "404 Not Found" response.
$ curl localhost:8080/example/META-INF/
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
$ curl localhost:8080/example/WEB-INF/web.xml
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
$ curl localhost:8080/example/WEB-INF/foobar
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
I would like to cutomize the content of this error page.
I've tried the following <error-page>
to web.xml of my application. This <error-page>
becomes effective for the normal "404 Not Found" response inside my web application, but it does not become effective for the above requests.
<error-page>
<error-code>404</error-code>
<location>/error/404.html</location>
</error-page>
How can I customize the content of the error page for such an invalid request accessing "/META-INF/" or "/WEB-INF/..." of web applications?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.