Tomcat configures https and access http to automatically jump to https, tomcathttps

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.