proxy pass with rewrite

Philipp Kraus philipp.kraus at
Fri Oct 25 05:57:01 UTC 2013


I would like to configure ngix with jenkins, nginx should be a proxy for the jenkins instance. I have configuration the proxy pass options in this way:

    location /jenkins  {
        proxy_pass         http://localhost:8080/;
        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;

My jenkins instance uses the port 8080 and I would like to pass the data from the URL http://mydomain/jenkins to the jerkins instance.
If I change the location to / everything works fine, but with the subdirectory alias I get an error with the URL. Jenkins result pages uses only
URLs to http://mydomain/<jenkins part> but in my case it should be http://mydomain/jenkins/<jenkins data>
I have modified the Jenkins URL (in the admin panel) to http://mydomain/jenkins/ but it seems to be an error on the reverse data call.
I must substitute all URL, which comes from the proxy_pass URL with http://mydomain/jenkins
How can I do this in a correct way?



More information about the nginx mailing list