https://www.cnblogs.com/parker-yu/p/10690837.html
修改tomcat\conf\web.xml文件也可,对该tomcat下所有程序生效

<!--强制使用https,http请求会自动转为https-->
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<!--配置网站支持https,/* 表示全部请求都走https, transport-guarantee 标签设置为 CONFIDENTIAL 以便使应用支持 SSL。
如果需要关闭 SSL ,将 CONFIDENTIAL 改为 NONE 即可-->
<security-constraint>
<web-resource-collection>
<web-resource-name>securedapp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

本文介绍如何通过修改Tomcat的web.xml文件,强制所有请求使用HTTPS,实现从HTTP自动跳转到HTTPS,确保数据传输的安全性。
2783

被折叠的 条评论
为什么被折叠?



