码迷,mamicode.com
首页 > Web开发 > 详细

tomcat从 http转成https,并且去掉端口号

时间:2017-01-05 18:03:59      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:nec   out   并且   https   realm   -name   encoding   code   http   

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/> 

改成

<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" URIEncoding="UTF-8"/> 

 

重启

这样用户也可以去掉端口同时访问http和https了

 

另: 强制https访问

 在tomcat\conf\web.xml中的</welcome-file-list>后面加上这样一段: 

<login-config>  
    <!-- Authorization setting for SSL -->  
    <auth-method>CLIENT-CERT</auth-method>  
    <realm-name>Client Cert Users-only Area</realm-name>  
</login-config>  
<security-constraint>  
    <!-- Authorization setting for SSL -->  
    <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> 

完成以上步骤后,在浏览器中输入http的访问地址也会自动转换为https了

 

tomcat从 http转成https,并且去掉端口号

标签:nec   out   并且   https   realm   -name   encoding   code   http   

原文地址:http://www.cnblogs.com/fanlinglong/p/6253091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!