nginx 网站页面JS报错 Mixed Content The page at ‘httpsXXX’ was loaded over HTTPS, but requested an insecure


环境:

NGINX(HTTPS) -->TOMCAT

报错:

错误:Mixed Content: The page at ‘https://XXX’ was loaded over HTTPS, but requested an insecure........

主体框架可以正常加载, 但是内部借口和 iframe 里面的内容以及静态资源全部报错

解决方法:

1.让nginx传递给后端的转发内携带协议信息

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;

重点在最后一条

2.让tomcta识别https

修改tomcat server.xml 里的 Engine 模块下配置一个 Value:

<Valve className="org.apache.catalina.valves.RemoteIpValve"

remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto"

protocolHeaderHttpsValue="https"/>

其中
X-Forwarded-Proto 属性是为了让tomcat 识别请求是http的还是https的


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM