Not able to customize the 404 page for sonarqube embed tomcat

Hi all,

I have sonarqube installed on /opt/sonarqube-9.9.6.92038
and set sonar.properties.

sonar.web.context=/sonarqube
sonar.web.port=9999

I use http://127.0.0.1:9999/sonarqube to access the sonarqube.

but when I try to open http://127.0.0.1:9999 or http://127.0.0.1:9999/soanrqqqq
it will give the default tomcat 404 page.

Is there any way to customize the tomcat 404 page? let it not show the tomcat version or just show page not found.

I tried to update /opt/sonarqube-9.9.6.92038/web/WEB-INF/web.xml and put the error.html in /opt/sonarqube-9.9.6.92038/web/error.html,
but it’s not work.
Please help to give some advice, thanks.

    <error-page>
        <error-code>404</error-code>
        <location>/error.html</location>
    </error-page>

Hello,

Setting sonar.web.context seems unnecessary if you’re not using a reverse proxy such as nginx in front of SonarQube. Typically, it’s beneficial in scenarios where:

In this configuration, the reverse proxy manages the 404 page and it ensures that no requests are directed to http://127.0.0.1:9999.

Hi @Scott
I’m using reverse proxy for sonarqube, and the 9999 port not exposed to users.
but there is a scan mentioned the default tomcat index page or error page been detacted on port 9999, need to be removed…
so just want to know if there is any way to customize the pages.

Hi,

Welcome to the community!

This page is not customizable.

Could you share why you want to?

 
Thx,
Ann

Hi @ganncamp
Because when I use sonar.web.context=/sonarqube, there is a security scan ask to
Delete the default index page and remove the example JSP and servlets. Follow the Tomcat or OWASP instructions to replace or modify the default error page
so just want to know how to do it to fix.

Hi,

Thanks for sharing your use case. Unfortunately, the page is not customizable. You won’t be able to “fix” it.

 
Ann