部署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访问,是代理httpshttp,那么就一定要设置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;
  }
}
如果觉得我的文章对你有用,请随意赞赏