It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to prevent redirect to Tomcat error page

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 Community Leader Aug 06, 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.

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

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

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
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

7,524 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you