Self Hosted Gitlab Pull Request Decoration images are broken

Hello, I am using Sonarqube self-hosted and Gitlab Self hosted and during pull requests, I observe issues with the images - they are not showing up.

SonarQube:
Version: 9.3.0.51899
Developer Edition

I have configured the server URL and it seems like images have valid source URLs, but they are not shown in the Gitlab UI. When. I copy&paste this URL it gets resolved fine and the image is shown well.

Image URL:

http://10.20.0.216:9000/static/developer-server/checks/QualityGateBadge/failed-16px.png

We run the Sonar behind nginx proxy with config

server{
    listen      80;

    access_log  /var/log/nginx/sonar.access.log;
    error_log   /var/log/nginx/sonar.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    location / {
        proxy_pass  http://127.0.0.1:9000;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto http;
    }
}

What am I missing?


//EDIT: It seems like the issue is caused by Sonar or Gitlab enforcing images to go over HTTPS.

The issue is caused by browser native “mixed content needs HTTP to HTTPS redirected” behaviour.

1 Like

Good catch @fniko
thanks for sharing!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.