How to configure a custom error page for the path which is served through EAP 7 file handler
Issue
I'm using <file> handler to serve static contents like the following:
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
...
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"></http>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"></location>
<location name="/example" handler="my-static-contents"></location> <!-- added this -->
...
</host>
</server>
...
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"></file>
<file name="my-static-contents" path="/path/to/custom/static-content/"></file> <!-- added this -->
</handlers>
...
</subsystem>
How do I specify a custom error page for the <file> handler? For example, I would like to return custom "404 Not Found" error page when the client access non-existent URI under the path. Currently, it returns Undertow's default error page.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
