Structs2 Reponse rediret 使用https
2017-05-28 22:16
113 查看
问题:
Structs2 action中的redirect只支持Http,当应用部署在Https环境下时。会报错:Mixed Content: The page at ‘https://managertest.efun.com/userlogin.mainWindow.shtml’ was loaded over HTTPS, but requested an insecure script ‘http://manager.efun.com/js/upload.js‘. This request has been blocked; the content must be served over HTTPS.
<action name="serviceManagerAction_*" class="serviceManagerAction" method="{1}"> <result name="listPage">/serviceList.jsp</result> <result name="updateUI"> /serviceList.jsp </result> <result name="update" type="redirect"> serviceManagerAction_search.shtml?searchGame=${gid}&beginTime=${beginTime}&endTime=${endTime}&area=${area}&gameCode=${gameCode} </result> <result name="delete" type="redirect"> serviceManagerAction_search.shtml?searchGame=${gid}&beginTime=${beginTime}&endTime=${endTime}&area=${area} </result> <result name="save" type="redirect"> serviceManagerAction_search.shtml?searchGame=${gid}&beginTime=${beginTime}&endTime=${endTime}&area=${area}&gameCode=${gameCode} </result> </action>
解决过程
查询解决方案,可以使用struts2-ssl-plugin插件,使用说明于是按照文档部署,测试时发现服务器不断重定向请求,问题处理失败。日志如下:
[2017-01-16 17:09:34.326] {http-192.168.10.39:8040-1$1934196892} Going to SSL mode, redirecting to https://managertest.efun.com:443/userlogin.mainWindow.shtml
之后发现服务器中使用https是通过ngnix根据域名的规则将所有请求转为https的。重定向的问题可能和这个有关。但是具体原因不清楚。 既然是通过ngnix来转https的。那么考虑也通过Ngnix将应用的Response的redirect也转换为Htpps来解决问题
解决方案参考
How do I rewrite URLs in a proxy response in NGINX最后放个自己的静态页面博客: Vioao’s Blog
相关文章推荐
- JBoss4 应用服务器Web开发人员参考手册(4):使用HTTPS
- Java Tip 96: 使用 HTTPS 编写客户端程序
- Gmai新增小功能 可选择永远使用https连线
- 在J2ME中使用Socket通过cmwap接入点访问安全HTTPS
- Structs框架使用心得
- 在J2ME中使用Socket通过cmwap接入点访问安全HTTPS
- 使用 HTTPS 编写客户端程序
- weblogic webapp 使用https
- 在https页面中使用iframe出现安全警告的解决方法
- 用MIDP2使用HTTPS(本地服务器)
- 使用 gSOAP 通过 HTTP 和 HTTPS 调用由 WSAD 创建的 J2EE Web 服务
- 使用https://mail.google.com/登录GMail
- 使用 HTTPS 编写客户端程序
- 使用httpclient来进行https访问
- 在Tomcat中配置使用https的过程
- 使用 HTTPS 编写客户端程
- [JAVA][Structs]Structs使用多个配置文件
- https页面中使用iframe出现安全警告的解决方法
- Delphi中使用IdHTTP访问基于SSL协议(https)的网站
- Structs2使用心得