Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running Sonarqube behind a reverse proxy (Nginx)

We are trying to run sonarqube behind a reverse proxy (nginx).

We have nginx running on once instance within our AWS VPC, and sonarqube on another instance. Below is our sonarqube location block. NGINX is set to listen on port 80…

Sonarqube is running in a docker container with port 9000 mapped to 9000 on the host.

Our default location (below) redirects anything other than a valid location to the jira location. When we try to access sonarqube using the address of the machine running NGINX and /sonarqube, we just get redirected to Jira.

It is worth noting that all our other applications that have a location block in the nginx config work as expected.

location / {
                return 301 /jira;
        }
location /sonarqube {
        proxy_pass                           http://<ip-address of machine running sonarqube>:9000/sonarqube;
        proxy_set_header X-Forwarded-Host    $host;
        proxy_set_header X-Forwarded-Server  $host;
        proxy_set_header X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP           $remote_addr;
        proxy_redirect                       off;
        client_max_body_size                 8m;
        client_body_buffer_size              128k;
    }
like image 609
StephenBates Avatar asked Mar 22 '26 16:03

StephenBates


1 Answers

Is your sonar.properties correctly configured?

sonar.web.port:                           9000
sonar.web.context:                        /sonarqube

After that you can change your nginx config as

    location /sonarqube {
        proxy_pass         http://<sonarqube_ip>:9000;
        ...
    }
like image 58
S N Avatar answered Mar 24 '26 10:03

S N



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!