用nginx代理ssl ,但是仍旧走http,所以一般SERVER变量中的相关http协议的都还是https,所以需要
X-Forwarded-Proto(转发协议),可以判断是否https。但如果没有该变量需要自己加在请求头中
在nginx的配置加上如下图的:
proxy_set_header X-Forwarded-Proto $scheme;
location / {
#naxsi
include naxsi.rules;
#naxsi_white
include naxsi_white.rules;
proxy_set_header Accept-Encoding '';
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header From-Https on;
proxy_pass http://127.0.0.1:80;
}