Tomcat全局/局部https访问配置方法
赞
踩
文章来源:http://jingyan.baidu.com/article/15622f24164f7efdfdbea56b.html
Tomcat全局/局部https访问配置方法
在Tomcat部署景安SSL证书后,如需要全局转换成https访问,解决办法如下:
修改tomcat服务器的web.xml文件,在标记</webapp>前增加以下配置:
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>SSL</web-resource-name>
- <url-pattern>/*</url-pattern>
- </web-resource-collection>
- <user-data-constraint>
- <transport-guarantee>CONFIDENTIAL</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
如果是需要局部使用https访问,解决办法如下:
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>SSL</web-resource-name>
- <url-pattern>/test/*</url-pattern>
- </web-resource-collection>
- <user-data-constraint>
- <transport-guarantee>CONFIDENTIAL</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
这样配置,当访问路径包括test的时候,就会强制转换为https。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。