解决Nginx+Tomcat中https转http请求问题
2017-11-08 17:46
645 查看
今天遇到一个问题,在配置Nginx的https请求,tomcat使用http时,请求静态资源会报
解决方案:
1 Nginx对应server的location添加配置
注意:如果nginx里配置的upstream是非具体IP的,不要写localhost,应该写127.0.0.1,类似如下:
2 Tomcat的配置srever.xml
2.1 connector里添加
2.2 Host里添加
3 在防火墙里添加443端口的入站规则
Mixed Content: The page at 'https://a.b.com/detail?id=5' was loaded over HTTPS, but requested an insecure script 'http://a.b.com/xxxxxxx'. This request has been blocked; the content must be served over HTTPS.的问题。
解决方案:
1 Nginx对应server的location添加配置
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;
注意:如果nginx里配置的upstream是非具体IP的,不要写localhost,应该写127.0.0.1,类似如下:
upstream xxx{ server 127.0.0.1:8080 weight=1; }
2 Tomcat的配置srever.xml
2.1 connector里添加
redirectPort="443" proxyPrort="443"
2.2 Host里添加
<Valve className="org.apache.catalina.valves.RemoteIpValve" protocolHeaderHttpsValue="https" remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto" />
3 在防火墙里添加443端口的入站规则
相关文章推荐
- 解决Nginx+Tomcat下客户端https请求跳转成http的问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- https和http,IE7请求被拦截的问题解决
- Nginx出现The plain HTTP request was sent to HTTPS port问题解决方法
- httpclient、Nginx、tomcat之间请求长连接一致问题
- [线上问题] Nginx与Tomcat、Client之间请求的长连接配置不一致问题分析解决
- 解决 nginx https反向代理http协议 302重定向localtion到http问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- Nginx 学习笔记(八)http和https跨域问题解决
- httpclient、Nginx、tomcat之间请求长连接一致问题
- iOS开发工具-如何使用网络封包分析工具Charles,通过配置proxy对http、https、tcp、udp 等协议的请求响应过程交互信息进行分析、判断、解决我们移动开发中的遇到的各种实际问题。
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题
- httpclient、Nginx、tomcat之间请求长连接一致问题