明確:
http默認端口 80
https默認端口 443
將redirectPort=”8443”改為
redirectPort=”443”
service.xml
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="443" /> <!-- 配置屬性:algorithm認證編碼算法默認SunX509,clientAuth是否使用證書鏈,默認為false,sslprotocol表示ssl協議版本號,默認TLS,cipers可以使用的加密算法列表,用逗號隔開。 如果連接器上有http2protocol類型的升級協議upgradeprotocol組件,嘗試把壓縮參數放上面connector.findUpgradeProtocols(), --> <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" keystoreFile="cert/XXX.pfx" cipers="RSA,ECC" keystoreType="PKCS12" algorithm="SunX509" keystorePass="XXX" clientAuth="false" clientAuth="false" sslProtocol="TLS"> <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> </Connector>
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>
參考:https://blog.csdn.net/a1837634447/article/details/78270292