Nginx 反向代理过程中出现 https 访问 http 问题

  |   0 评论   |   0 浏览

一般对于浏览器来说 https 的网站 中访问 http 是 如下有问题的

Mixed Content: The page at 'https://www.xxx.com/' was loaded over HTTPS, 
but requested an insecure script 'http://www.xxx.com/a.js'.
 This request has been blocked; the content must be served over HTTPS.

修改 nginx 的 proxy 配置部分,如下所示

add_header Content-Security-Policy upgrade-insecure-requests;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

重启 nginx,这个时候我们会发现,问题解决了

---------------------------------------------------------------
>> 博客地址:https://blog.mufengs.com
>> 邮箱地址:[email protected]
>> 微信帐号:Do8080
>> Github : https://github.com/mufengcoding
---------------------------------------------------------------

评论

发表评论