diff --git a/roles/paas-docker/nginx/config.sls b/roles/paas-docker/nginx/config.sls --- a/roles/paas-docker/nginx/config.sls +++ b/roles/paas-docker/nginx/config.sls @@ -76,6 +76,7 @@ fqdn: {{ container['host'] }} app_port: {{ container['app_port'] }} aliases: {{ container['aliases'] | default('', true) | join(" ") }} + instance: {{ instance }} # If the nginx configuration needs more key, # pass directly the container dictionary. args: {{ container }} diff --git a/roles/paas-docker/nginx/files/vhosts/jenkins.conf b/roles/paas-docker/nginx/files/vhosts/jenkins.conf --- a/roles/paas-docker/nginx/files/vhosts/jenkins.conf +++ b/roles/paas-docker/nginx/files/vhosts/jenkins.conf @@ -32,17 +32,38 @@ include includes/letsencrypt; + ignore_invalid_headers off; + location / { proxy_redirect http:// https://; proxy_pass http://localhost:{{ app_port }}; include includes/proxy_params; + proxy_max_temp_file_size 0; # Required for new HTTP-based CLI # https://wiki.jenkins.io/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy proxy_http_version 1.1; proxy_request_buffering off; proxy_buffering off; # Required for HTTP-based CLI to work over SSL + + # Required for Jenkins websocket agents + proxy_set_header Connection $connection_upgrade; + proxy_set_header Upgrade $http_upgrade; + } + + location /userContent { + # If we move the front-end to another machine, + # this block must be removed. + + root /srv/jenkins/{{ instance }}/jenkins_home; + + sendfile on; + + if (!-f $request_filename) { + rewrite (.*) /$1 last; + break; + } } root /var/wwwroot-502/_default;