tomcat7.tomcat8配置強制跳轉https

首先你得學會如何配置https

http://blog.csdn.net/A_Xi_Baa/article/details/79192826


tomcat7編輯tomcat/conf/web.xml

 在</welcome-file-list>後面加入以下這段話
     <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>

修改完之後重啓就可以了,有問題的話有的發現網址指向的後面有個端口,解決如下

編輯tomcat/conf/server.xml,找到端口那裏,把【redirectPort="8443"】去掉

tomcat8編輯tomcat/conf/web.xml

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

修改完之後重啓就可以了,有問題的話有的發現網址指向的後面有個端口,解決如下

再編輯tomcat/conf/server.xml,找到端口那裏,把【redirectPort="8443"】去掉



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章