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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_15071263/article/details/82881542

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


1、环境

Tomcat
Nginx 【走https 通道】
框架形式是以 iframe 作为支撑的

2、问题

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

3、让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;
4、让Tomcat 识别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的

猜你喜欢

转载自blog.csdn.net/qq_15071263/article/details/82881542