一般出现这个问题原因是你的代理地址是非https的,而被代理的地址是https的,解决方案
完整的反向代理代码:
#PROXY-START/
location ^~ /
{
#被代理的地址
proxy_pass http://your-backend-server;
proxy_set_header Host abacus.zhucn.org;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
#强制指定SSL协议,就不会出现502了
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# proxy_hide_header Upgrade;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_fileB1qufNZH 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileB1qufNZH 1;
expires 1m;
}
if ( $static_fileB1qufNZH = 0 )
{
add_header Cache-Control no-cache;
}
}
#PROXY-END/