1. 程式人生 > >Tomcat配置強制https埠變成8443的解決辦法

Tomcat配置強制https埠變成8443的解決辦法

Tomcat配置強制https埠變成8443的解決辦法

2017年10月18日 10:44:10 我們始終是路人 閱讀數:2953 標籤: tomcathttps8443443 更多

個人分類: Tomcat

版權宣告:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/a1837634447/article/details/78270292

明確: 
http預設埠 80 
https預設埠 443 
將redirectPort=”8443”改為 
redirectPort=”443”

service.xml

 <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="443" />
  • 1
  • 2
  • 3
  • 4
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               keystoreFile="cert/XXX.pfx"
                keystoreType="PKCS12"
                keystorePass="XXX"
               clientAuth="false" sslProtocol="TLS"/>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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>