公司全部网站需要支持 HTTPS 协议,在阿里云负载均衡配置 SSL 证书后,导致 Nexus 的 HTTPS 访问出错。
网站访问路径:域名解析到阿里云的负载均衡,负载均衡配置 80 端口强转 443 端口,443 端口配置 SSL 证书,并转发到内网 nginx,内网的 nginx 再代理 Nexus 服务。
解决浏览器 HTTPS 访问 Nexus 的 Console 报错信息:
报错信息大致意思是:HTTPS 访问的页面上不允许出现 HTTP 请求。
解决方法:在 nginx 配置文件增加 “proxy_set_header X-Forwarded-Proto https;” ,这样 nginx 在转发时就使用 HTTPS 协议。
nginx.conf 中的 nexus 配置内容:
1location ^~ /nexus { 2 3 proxy_pass http://x.x.x.x:8080/nexus; 4 5 sendfile off; 6 7 proxy_set_header Host $host; 8 proxy_set_header X-Real-IP $remote_addr; 9 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 10 proxy_set_header X-Forwarded-Proto https; # 转发时使用https协议 11 proxy_max_temp_file_size 0; 12 13 # This is the maximum upload size 14 client_max_body_size 20m; 15 client_body_buffer_size 128k; 16 17 proxy_connect_timeout 90; 18 proxy_send_timeout 90; 19 proxy_read_timeout 90; 20 21 proxy_temp_file_write_size 64k; 22 23 # Required for new HTTP-based CLI 24 proxy_http_version 1.1; 25 proxy_request_buffering off; 26 proxy_buffering off; # Required for HTTP-based CLI to work over SSL 27 } ---来自腾讯云社区的---叨叨软件测试
微信扫一扫打赏
支付宝扫一扫打赏