Jenkins 通过nginx使用Https协议反向代理

Jenkins 反向代理Https


问题描述

使用nginx 对Jenkins做反向代理,nginx使用https协议,Jenkins使用http访问,用https://jenkins.com 访问可以正常进入首页,在首页里点击其他功能页时,跳转会自动请求协议为http的协议。所以我们需要将跳转其他功能页时,使用的协议也修改为https。

解决方式

需要在nginx配置中加入 proxy_set_header X-Forwarded-Proto $scheme; 这个请求头。

        location / {
                proxy_set_header X-Rea $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-Nginx-Proxy true;
                proxy_pass http://localhost:3083;
                proxy_set_header X-Forwarded-Proto $scheme;
       }

posted @ 2019-08-12 17:40  晚安,Jake  阅读(1434)  评论(0编辑  收藏  举报