Nginx + Tomcat solve the problem https turn http request

Console error:
Mixed Content: AT at The Page ' ' was loaded over HTTPS, but requested an insecure script ' . 'This request has been blocked; the content must be served over HTTPS.
Solution:
1.Nginx added LOCATION corresponding to the configuration server

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;

Note: If the upstream non-specific IP in the nginx configuration, do not write the localhost, you should write 127.0.0.1, similar to the following:

upstream xxx{
        server 127.0.0.1:8080 weight=1;
}

Configuring srever.xml 2.Tomcat of
2.1 connector where add

redirectPort="443" proxyPrort="443"

The net effect is: <Connector port="8006" protocol="AJP/1.3" redirectPort="443" proxyPrort="443" />

2.2 Host in new

<Valve className="org.apache.catalina.valves.RemoteIpValve" protocolHeaderHttpsValue="https" remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto" />

Guess you like

Origin www.cnblogs.com/sanduzxcvbnm/p/12612212.html