How to hide details from Tomcat error page

Question

By default, the Tomcat error page provides detailed information about the error thrown and also reveals its version. How can we hide this?

Answer

The Tomcat error page details can be suppressed with the following configuration.

- Edit the file <tomcat_install_folder>/conf/server.xml
- Find the parameters <Host name=
- Below that line, add the following parameters:

<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />

- Restart Tomcat.