请注意,本文编写于 1716 天前,最后修改于 640 天前,其中某些信息可能已经过时。
部署Jenkins后,一直出现以下的错误:
An error message is displayed in the "Manage Jenkins" page - "It appears that your reverse proxy set up is broken"
出现这个错误以后,我们点击更多信息,进到官网的解释,看以看到有这么一个警告:
Be sure to set the X-Forwarded-Proto header if your reverse proxy is accessed via HTTPS and then Jenkins itself is accessed via HTTP i.e. proxying HTTPS to HTTP.
这句话的大概意思是: 如果你的反向代理使用https
访问,并且jenkins
使用http
访问,是代理https
到http
,那么就一定要设置X-Forwarded-Proto
这个请求头。
server {
listen 80;
server_name jenkins.mydomain.com;
location / {
proxy_pass http://jenkins.localnet:8080;
proxy_read_timeout 90;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}