technology:linux:jenkins反向代理配置有误问题

需要一个持续集成的工具,所以部署了一个jenkins。由于服务器上本身存在一个nginx,所以jenkins我部署了反向代理,但是每次访问后台都有这样一个错误,不胜其烦。1)

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;
  }
}

  • technology/linux/jenkins反向代理配置有误问题.txt
  • 最后更改: 2019/09/09 11:56
  • (外部编辑)