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