Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Enable Tomcat for HTTPS & SSL

DZone's Guide to

Enable Tomcat for HTTPS & SSL

Enable your Tomcat Application Server in HTTPS mode as opposed to HTTP mode in 5 simple steps.

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

This tutorial demonstrates how to enable a Tomcat Application Server in https mode, i.e access your application as https://{appname} rather than http://{appname}

Solution: 
1. First create a digital certificate & point Tomcat to it as shown below. 
2. Navigate to <Home Dir>/conf/server.xml
3. Turn SSL Engine ON. Look for "SSLEngine" & un-comment if commented

<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>

4. Comment out connector executor for non-SSL port 8080

5. Define a SSL HTTP/1.1 Connector on port 443

<Connector 
SSLEnabled="true" 
URIEncoding="UTF-8" 
keyAlias="tomcat" 
keystoreFile="${catalina.base}/conf/.keystore"
port="443" 
protocol="org.apache.coyote.http11.Http11NioProtocol" 
scheme="https" 
secure="true"/>

<Connector
   clientAuth="false" port="8443" minSpareThreads="5" maxSpareThreads="75"
   enableLookups="true" disableUploadTimeout="true"
   acceptCount="100" maxThreads="200"
   scheme="https" secure="true" SSLEnabled="true"
   keystoreFile="${catalina.home}/conf/Dimit.jks"
   keystoreType="JKS" keystorePass="dimit123"
   truststoreFile="${catalina.home}/conf/cacerts.jks"
   truststoreType="JKS" truststorePass="dimit123"
   SSLVerifyClient="require" SSLEngine="on" SSLVerifyDepth="2" sslProtocol="TLS"
/>

Access Tomcat as https://localhost:8443

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:
tomcat ,ssl ,https ,java

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}