Tomcat automatically redirects HTTPS notes

Source: Internet
Author: User

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

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.