This blog does not discuss Nginx, Apache, or other agents to implement HTTPS forms of access, only to discuss the automatic redirection of Tomcat HTTPS.
1. Certificate request, issue, import, generate: This step is based on the official manual
JKs and KeyStore are generally two different formats
2. Server.xml Configuration
<!-- Connector definition for TCP port 80 --><Connector port="80" maxHttpHeaderSize="8192" maxThreads="150" useBodyEncodingForURI="true" enableLookups="false" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml"/> <!-- Connector definition for SSL port 443 -->
<connector port= "443" protocol= "http/1.1" sslenabled= "true"
maxthreads= "scheme=" "https" secure= "true"
clientauth= "false" sslprotocol= "TLS" keystorefile= "/tomcat.keystore" keystorepass= "123456789"/>
3. Configure the Web. xml file
<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>
4. Restart Service
1, RM-RF work/*
2. Service Tomcat restart
This article is from the "Ningzhiyuan 51CTO blog" blog, be sure to keep this source http://renzhiyuan.blog.51cto.com/10433137/1878511
Tomcat automatically redirects HTTPS notes