如果要反代是同一域名,nginx配置如下
- location / {
- proxy_pass https://域名.cdn.cloudflare.net;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_ssl_name $host;
- proxy_ssl_server_name on;
- }
如果不是同一域名,cf上的域名为www.google.com(例子,老),想要用www.baidu.com(新)访问
- location / {
- proxy_pass https://域名或IP;
- proxy_set_header Host www.google.com(cf上的域名);
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_ssl_name www.google.com(cf上的域名);
- proxy_ssl_server_name on;
- }
重点是
- proxy_ssl_name $host;
- proxy_ssl_server_name on;
声明:本站所有文章或资源,均来自互联网分享。本站不参与制作或存储,内容仅用于互联网爱好者学习和研究,如不慎侵犯了您的权利,请及时联系站长处理删除。敬请谅解!
评论(0)