How to remove the server version from Tomcat server error pages?
search cancel

How to remove the server version from Tomcat server error pages?

book

Article ID: 434313

calendar_today

Updated On:

Products

VMware Smart Assurance Network Observability

Issue/Introduction

The Apache Tomcat error page (e.g. 404 not found) includes the Tomcat server version.  

 

Environment

All supported versions.

Resolution

To configure the Tomcat server so that it doesn't reveal its version in publicly accessible error reports (https://servername:8880/<page>), edit
your ServerInfo.properties

1. Find the catalina.jar file in your Tomcat installation and extract the ServerInfo.properties file from it. 
$SMARTS_HOME/smarts/CONSOLE/smarts/tomcat/lib


Note: Make a copy of Original catalina.jar and the file permissions-owner information for further references.

2. To extract the ServerInfo.properties file from catalina.jar, run the following:

jar xf catalina.jar org/apache/catalina/util/ServerInfo.properties

This command instructs jar to extract the ServerInfo.properties file that is located in /org/apache/catalina/util inside catalina.jar. 
You can change these values to anything you like or delete a value. For instance, you could change the following parameters:

server.info=Apache Tomcat <tomcat version>
server.number=<version>
-----------to the below:-----------
server.info=Apache Tomcat
server.number=0.0.0.0

When you're happy with the changes, save the file and exit. You will still need to compress the modified file to catalina.jar, which you can do
with the following command:

jar uf catalina.jar org/apache/catalina/util/ServerInfo.properties

Note: You can delete the org directory after you've replaced it with your modified one or move it to a temporary location for further references.

3. Set the correct file permissions-owners again as per the reference earlier.

Example:
-rw-r----- 1 root root 1.5M Dec* 3* 2025 catalina.jar

4. Restart tomcat service.

Additional Information

To restart the tomcat service used by the console, use the sm_service command from /$SMARTSHOME/CONSOLE/smarts/bin/ 

 ./sm_service stop WEBCONSOLE

 ./sm_service start WEBCONSOLE

NOTE.  Do not use proprietary tomcat commands!!!   

Running Tomcat as an independent function instead of using sm_service causes log rotation failures and orphaned processes․  We would see:​​

Logs written to tomcat/logs instead of smarts/local/logs
Log rotation fails to trigger or manage new log files
Tomcat processes become orphaned with no active log output
Environment variables and heap adjustments fail to apply

The CONSOLE webpage would be up but we would not see it from a sm_service show command e.g. 

 ./sm_service show
RUNNING NPM-OSPF
RUNNING SMARTS-WEBSWING
RUNNING AM-PM
RUNNING OPENSEARCH
RUNNING NPM-EIGRP
NOT RUNNING SYSLOG-ADAPTER
RUNNING BROKER
RUNNING NPM-ISIS
RUNNING RABBITMQ
RUNNING MBIM
RUNNING NPM-BGP
RUNNING TOMCAT
NOT RUNNING TRAP-ADAPTER
RUNNING SAM-PRES
RUNNING OI
RUNNING SAM
RUNNING CAS
RUNNING IP-CONFIG
RUNNING ESM
NOT RUNNING WEBCONSOLE

NOTE.  There are 2 TOMCAT services running on this example server; 

  1. the WEBCONSOLE that we are interested in.

  2. The instance named as TOMCAT refers to the Elastic Data Access Agent (EDAA) interface, specifically the Microservice Architecture (MSA) endpoint used for managing and retrieving notifications (alerts) from the Smarts Service Assurance Manager (SAM).  The EDAA is a REST-based API layer that allows external applications and the Smarts Frontend (UI) to interact with the underlying Smarts domain managers.