Nginx and css reverse proxy images not loading

I am trying to configure a nginx reverse proxy to access a Jenkins instance. I can open the authentication page, but there is no CSS and no image. It works great with direct access.

Everything works as if the reverse proxy is not rewriting correctly the URLs defined on the html source page. Did I miss something?

Here is my nginx configuration:

    location /jenkins {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect false;
            proxy_pass http://jenkins:8080/;
    }
+4
source share
2 answers

I have found a solution. The nginx reverse proxy works fine, but Jenkins needs some configuration to work with the reverse proxy.

Last nginx configuration:

    location /jenkins/ {
    proxy_pass http://jenkins:8080/jenkins/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

, jenkins nginx,

+6

, OP, , :

  location ^~ /jenkins/ {
    proxy_pass http://jenkins:8080/jenkins/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
+4

All Articles