您的位置:首页 > 理论基础 > 计算机网络

强制https访问(tomcat服务器下)

2017-01-17 13:31 323 查看

在tomcat/conf/web.xml中的</welcome-file-list>和</web-app>之间加上这样一段,

一定要加上<security-constraint>标签:

<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>

当然之前得在tomcat/conf/server.xml配置文件中配置80端口redirectPort到443端口,这里就不细说了,然后重启tomcat。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: