Tomcat configures https and access http to automatically jump to https, tomcathttps
Tomcat configures https and access http to automatically jump to https
1. Configure Tomcat, open $ CATALINA_HOME/conf/server. xml, and modify it as follows:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
Modify parameter ==>
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" />
<!--<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"maxThreads="150" scheme="https" secure="true"clientAuth="false" sslProtocol="TLS" />-->
Remove comments and modify parameters ==>
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="d:/dev/tomcat.keystore" keystorePass="123456" />
<!--<Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="8443" />-->
Modify parameter ==>
<Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="443" />
Ii. Local https secure connection ConfigurationOpen the web Project \ WEB-INF \ web. xml file, and add the following after the file </welcome-file-list>:
<! -- Local https secure connection configuration --> <security-constraint> <display-name> Auth </display-name> <web-resource-collection> <web-resource-name> Protected area </web-resource-name> <! -- <Url-pattern>/index/json/login </url-pattern> <url-pattern>/admin/json/admin/companyLogin </url-pattern> <url- pattern>/admin/companyLogin </url-pattern> <url-pattern>/admin/agentLogin </url-pattern> --> <url-pattern>/user/* </ url-pattern> <url-pattern>/main/index </url-pattern> </web-resource-collection> <user-data-constraint> <description> SSL required </description> <transport-guarantee> CONFIDENTIAL </transport-guarantee> </user-data-constraint> </security-constraint>
After the preceding configuration is complete, you can use SSL after restarting TOMCAT. In the IE address bar, you can directly enter the address without entering "http: //" or "https: //". Alternatively, you can enter "http: //" to jump to "https: // "to log on
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!