master/proxy/nginx.conf

45 lines
1.3 KiB
Nginx Configuration File

#
# This nginx configuration is meant to be embedded into a Jenkins master container
# for automatically routing some things
#
# Related to: https://issues.jenkins-ci.org/browse/JENKINS-46706
server {
listen 80;
location = / {
return 301 /blue/pipelines;
}
# Only allow the usage of the Blue Ocean Pipeline creation flow.
# https://github.com/CodeValet/codevalet/issues/10
location = /newJob {
return 301 /blue/organizations/jenkins/create-pipeline;
}
# Send "abusive" routes to Code Valet's abuse disclaimer page rather than
# somewhere else within Jenkins. This should help avoid undo load on
# Jenkins instances.
#
# See also: https://github.com/CodeValet/master/issues/1
location ~ /(cli|asynchPeople) {
return 301 https://codevalet.io/abuse/;
}
location ~ ^/api(/json|xml|python)? {
return 301 https://codevalet.io/abuse/;
}
location ~ job/(.*)/api(/json|xml|python)? {
return 301 https://codevalet.io/abuse/;
}
location / {
proxy_redirect off;
proxy_set_header Host $http_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 $scheme;
proxy_pass http://localhost:8080;
}
}