反代CloudFlare出现错误的解决方法
中有提到解决方案
在反代的配置文件里面
两个location区块都加上:
proxy_ssl_name $host; proxy_ssl_server_name on;
或者(记得换域名)
proxy_ssl_server_name on; proxy_pass https://www.kfcquan.com;
今天实战测试了下还是有问题,需要进行如下调整【域名记得换城自己的】
proxy_ssl_name www.kfcquan.com; proxy_ssl_server_name on;
最后参考效果(实测成功):
#PROXY-START/
location ~* \.(gif|png|jpg|css|js|woff|woff2)$
{
proxy_ssl_name cloud.kfcquan.com;
proxy_ssl_server_name on;
proxy_pass https://cloud.kfcquan.com;
proxy_set_header Host cloud.kfcquan.com;
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;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
proxy_ignore_headers Set-Cookie Cache-Control expires;
add_header Cache-Control no-cache;
expires 12h;
}
location /
{
proxy_ssl_name cloud.kfcquan.com;
proxy_ssl_server_name on;
proxy_pass https://cloud.kfcquan.com;
proxy_set_header Host cloud.kfcquan.com;
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;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
proxy_set_header Accept-Encoding "";
sub_filter "cloud.kfcquan" "www.kfcquan";
sub_filter_once off;
add_header Cache-Control no-cache;
}
#PROXY-END/













