I work on a JSF application powered by Tomcat 7.0.35. I would like to create a custom error page and have therefore played with the <error-page>
tag in the web.xml
configuration file.
<error-page>
<error-code>404</error-code>
<location>/error</location>
</error-page>
It seems to work in the sense that in case of a 404, the page returned has the correct HTTP body. However the HTTP return code is 200. The expected 404 was correctly received when <error-page>
was not configured.
The same soft-404 problem happens if <error-code>
is not specified.
<error-page>
<location>/error</location>
</error-page>
I am looking for a way to configure this error page without losing the error code.
Two more pieces of information that might be useful :
- The JSF project stage is Production
Pretty URLs are being handled by Pretty Faces 3.3.3 with the following
@Named(value = "error") @RequestScoped @URLMappings(mappings = { @URLMapping(id = "error", pattern = "/error", viewId = "/faces/error.xhtml")}) public class ErrorController implements Serializable {