Sonarqube url has changed without changing context

Hi!
Using:

  • SonarQube 7.9.3
  • Nginx as reverse proxy for SSL/TLS.

We are trying to access sonarqube using this url:

https://<our domain>/sonar

We have the following configuration setting to:

sonar.web.context=/sonar

Nothing happens in browser.

Then when we try:

https://<our domain>/sonar/

with the extra slash it works!
But why is context changed? Any ideas?

br,

//mikael

I forgot to mention my sonar is running as:

sonar.web.context=/sonar
sonar.web.host=0.0.0.0
sonar.web.port=8080

and I have the following setting for nginx ( as suggested here):

location / {

        # Redirect to Sonar
        proxy_pass              http://127.0.0.1:8080;

    }

What am I missing here?

Hi Mikael,

You have configured SonarQube correctly. Without being a NGINX expert, I can tell the problem lies in your Nginx configuration and the location “/” that you have configured. This is out of SonarQube scope and what we can help you with.

I can for sure confirm that your SonarQube Web Server is listening on http://127.0.0.1:8080/sonar, but Nginx is not matching and forwarding the request upon you hitting https://<our domain>/sonar as you are expecting. It is probably handing the request directly to http://127.0.0.1:8080 instead. I would advice reading the Beginner’s Guide of NGINX on the “location” syntax. They have very good examples.

Cheers,
Daniel

Thx! Great info got it working. Setup for nginx should be:

location /sonar {


            # Redirect to Sonar
            proxy_pass              http://0.0.0.0:8080/sonar;

        }
1 Like