强制跳转HTTPS

来源:互联网 发布:python获取当天日期 编辑:程序博客网 时间:2024/05/19 17:06

在Web.xml里面配置如下代码,就可以实现输入:http://localhost:8080/projectName直接跳转到:https://localhost:8443/projectName/login.jsp

[java] view plain copy
  1. <login-config>  
  2.     <auth-method>CLIENT-CERT</auth-method>  
  3.     <realm-name>Client Cert Users-only Area</realm-name>  
  4. </login-config>  
  5.   
  6. <security-constraint>  
  7.     <web-resource-collection>  
  8.         <web-resource-name>SSL</web-resource-name>  
  9.         <url-pattern>/*</url-pattern>  
  10.     </web-resource-collection>  
  11.     <user-data-constraint>  
  12.         <transport-guarantee>CONFIDENTIAL</transport-guarantee>  
  13.     </user-data-constraint>  
  14. </security-constraint>  

0 0
原创粉丝点击