Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent redirect to Tomcat error page

Joakim Sahlgren
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 6, 2018

When the URL contains a null byte (%00) in the URL parameter, the Tomcat error page will be displayed. This page includes the Tomcat server version.

Example: https://myhostname?page=%00

Is it possible to hide the server information and version on this page or redirect to the 'not found' page?

I have tried the following steps:

1. Stop Confluence.

2. Unpack the catalina.jar file: 

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

3. Update the ServerInfo.properties file by changing the server.info line to server.info=X.

4. Repackage the catalina.jar file:

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

5. Start Confluence.

The Confluence server will start and the updated info will be displayed. However, the change will cause the instance health check to fail and multiple exceptions are logged in catalina.out.

The updated catalina.jar file has the same owner and permissions as the original file. When I restore the original file and restart Confluence, the instance health check will pass again.

 

1 answer

1 accepted

0 votes
Answer accepted
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2018

I would run confluence behind a reverse proxy(apache) and redirect apache to a custom error page, instead of hacking the jar archives or

create the file lib\org\apache\catalina\util\ServerInfo.properties and add server.info=Apache Tomcat Version X to it. Restart tomcat/confluence.

or edit the /web.xml to capture the http code and show your custom error.html. Please See https://confluence.atlassian.com/confkb/how-to-customize-the-page-not-found-404-page-720412489.html for further reference.

Joakim Sahlgren
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 7, 2018

Thanks Danyal, we will go with the reverse proxy solution.

Fayaz Abdul
Contributor
May 1, 2019

Hi @Joakim Sahlgren @Danyal Iqbal ,

Did this reverse proxy solution works for you and how?

Please let me know.

Thanks

Like Jonas Keller likes this
Jonas Keller
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 31, 2020

Hello @Joakim Sahlgren @Fayaz Abdul 

I also tried the reverse proxy solution using Nginx.

The relevant code snippet in the server section but outside the "location /" is 

error_page 400 /error.html;
location = /error.html {
internal;
root /var/www/html;
}

but it does not work for me.

Not sure if this is not working because of Nginx or Tomcat/ Confluence so I'd be thankful for feedback from your side!

Thanks 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events