Tomcat: Hide version at error pages

Hi,

when a tomcat server is configured to print out its version on error pages

add the following XML node under the host node of server.xml

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

This configures tomcat to just return an Error 404 and not the tomcat 404 error page. Example

<Host appBase="myApp" autoDeploy="true" deployOnStartup="true" deployXML="true" name="localhost" unpackWARs="true">
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="access_log." />
    <Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Host>  

Michael

Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.