NginX reverse proxy for a Jenkins in Nomad issue

I’ve moved a Jenkins instance from a dedicated node into a Nomad cluster ran as a docker, and had a very strange issue with redirections: most of the locations worked, but clicking on “/manage” would lead to “https://jenkins/manage” instead of “https://jenkins.fqdn/manage”, breaking the URL of course.

I could not find a root cause in either Internet-facing load-balancer, nor in internal load-balancers, consul-template configurations, or very nomad jobs.

A workaround turned out to be a hard-coding line in the configuration of the first in the line, Internet-facing load balancer (NginX)

# grep proxy_redirect /etc/nginx/sites-enabled/jenkins | tail -1
      	proxy_redirect		https://jenkins/ https://jenkins.simulakrum.diskstation.eu/;

That solved it for all of the URLs for alpine-based Jenkins-in-Docker ran in Nomad.

Leave a Comment

Your email address will not be published. Required fields are marked *