0

How can I hide Server Information on Tomcat Web Application Manager?

I am using Apache Tomcat/9.0.37.

enter image description here

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • No, I just want to hide the Server Information view on the footer of the tomcat manager web page, not a whole tomcat manager web page. – Sekti Andarbeni Aug 18 '21 at 09:44
  • 1
    You want to hide the version information from your administrators (who are the target audience of the manager application)? Is it because you're uncomfortable demonstrating that your version is more than 1 year old and might require updates? In that case: Update. – Olaf Kock Aug 18 '21 at 10:12
  • Any reason. I just want to hide that. I really appreciate if anyone can answer my question. – Sekti Andarbeni Aug 18 '21 at 11:19
  • Overriding `org/apache/catalina/util/ServerInfo.properties` (e.g. by creating such a file in `$CATALINA_BASE/lib`) will change the server version string everywhere it is used. – Piotr P. Karwasz Aug 18 '21 at 11:30
  • Really Sorry it does not answer my question. I want to hide whole server information that appeared when I open tomcat manager. I do not want to show IP, OS Version, etc. – Sekti Andarbeni Aug 18 '21 at 13:25

1 Answers1

0

While newer parts of Tomcat Manager use JSP pages for visualization (cf. WEB-INF/jsp), the /html/list page is still formatted entirely in Java code (cf. HTMLManagerServlet#list).

To modify the appearance of the class you need to replace at least the Constants class.

In your case it is sufficient to replace the SERVER_HEADER_SECTION and SERVER_ROW_SECTION constants with empty strings and call:

javac Constants.java

The resulting class file must be placed in $CATALINA_BASE/lib/org/apache/catalina/manager so it can replace the default one.

Remark: I totally agree with Olaf's comment: hiding this information from Tomcat Manager users is counterproductive. I posted this answer as an example of modification of the /html/list view.

A better way would be to replace the Java code with a JSP page (like all other views) and send a PR to Tomcat's github repository.

Piotr P. Karwasz
  • 12,857
  • 3
  • 20
  • 43