Tomcat supports SSL/TLS through two implementations: JSSE (Java’s built-in SSL engine) and OpenSSL (via the Tomcat Native/APR library or the Java 22+ Foreign Function & Memory API). Both implementations are configured using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apache/tomcat/llms.txt
Use this file to discover all available pages before exploring further.
<SSLHostConfig> element nested inside an SSL-enabled <Connector>, and both support the same XML attribute vocabulary. The choice of implementation affects performance characteristics and certificate management options rather than the configuration structure.
SSL Implementation Options
JSSE (Default)
Pure-Java TLS implementation bundled with every JDK. No native library required. Works with JKS, PKCS12, and PEM certificate formats. Recommended for most deployments.
OpenSSL via APR / Tomcat Native
Uses the Tomcat Native library (compiled against OpenSSL) loaded by
AprLifecycleListener. Provides superior performance under high connection rates and access to OpenSSL cipher strings.OpenSSL via FFM API (Java 22+)
Uses OpenSSL through Java 22’s Foreign Function & Memory API. Enabled via
OpenSSLLifecycleListener in server.xml. No separate native .so/.dll required beyond the system OpenSSL library.Choosing an Implementation
If you are on Java 22+ and want OpenSSL performance without compiling Tomcat Native, use the FFM listener. Otherwise JSSE is the safest default for portability.
AprLifecycleListener must be present (it is included by default in server.xml):
Enabling HTTPS with JSSE
Create or obtain a certificate
For development, generate a self-signed certificate with the JDK For production, use a certificate signed by a trusted CA or obtain a free certificate from Let’s Encrypt (see the tip below).
keytool utility:Place the keystore
Copy the keystore file into
$CATALINA_HOME/conf/ or any accessible path. The default server.xml example references conf/localhost-rsa.jks.Enable the SSL Connector in server.xml
Uncomment (or add) the HTTPS Connector. The example below matches the commented-out connector in the default
server.xml:SSLHostConfig Attributes
The<SSLHostConfig> element controls the TLS handshake parameters that apply to a virtual hostname. When multiple virtual hosts share one connector, each host gets its own <SSLHostConfig> identified by the hostName attribute (the default is _default_).
| Attribute | Default | Description |
|---|---|---|
hostName | _default_ | Virtual hostname this config applies to. Must match an SNI value. |
sslProtocol | TLS | The overarching protocol family. Normally left as TLS. |
protocols | all | Comma/plus-separated list of enabled TLS versions. Example: TLSv1.2+TLSv1.3 |
ciphers | JVM default | Cipher suite list in JSSE format (e.g. TLS_AES_256_GCM_SHA384) or OpenSSL cipher string. |
honorCipherOrder | false | When true, server cipher preference is used instead of client preference. |
certificateVerification | none | Client certificate verification: none, optional, optionalNoCA, or required. |
truststoreFile | — | Path to the trust store used for client certificate verification. |
truststorePassword | — | Password for truststoreFile. |
truststoreType | JKS | Type of the trust store: JKS, PKCS12, etc. |
disableSessionTickets | false | Set true to disable TLS session tickets (improves forward secrecy). |
sessionCacheSize | 0 (unlimited) | Maximum number of SSL sessions in the cache. |
sessionTimeout | 86400 | SSL session timeout in seconds (default 24 hours). |
<Certificate> Element Attributes
Each <SSLHostConfig> element must contain at least one <Certificate> child that identifies the server’s TLS certificate and key material. Multiple <Certificate> elements with different type values (e.g. one RSA and one EC) enable dual-certificate configurations where the server picks the best certificate for each client.
| Attribute | Description |
|---|---|
type | Certificate algorithm: RSA, EC, or DSA. Must match the key type. |
certificateKeystoreFile | Path to a JKS or PKCS12 keystore containing the certificate and private key. |
certificateKeystorePassword | Password to unlock the keystore. |
certificateKeystoreType | Keystore format: JKS (default) or PKCS12. |
certificateKeyAlias | Alias of the entry to use within the keystore when it contains multiple entries. |
certificateFile | Path to a PEM-encoded certificate file (alternative to keystore). |
certificateKeyFile | Path to a PEM-encoded private key file (used together with certificateFile). |
certificateChainFile | Path to a PEM file containing intermediate CA certificates. |
HTTP/2 with SSL
HTTP/2 requires HTTPS and is enabled by nesting an<UpgradeProtocol> element inside the SSL <Connector>. The default server.xml includes this in the commented-out HTTPS connector example:
HTTP/2 mandates TLSv1.2 or higher and prohibits many older cipher suites defined in the HTTP/2 cipher blacklist (RFC 7540, Appendix A). If you restrict ciphers manually, ensure at least one non-blacklisted cipher is enabled.
Client Certificate Authentication
Mutual TLS (mTLS) requires each connecting client to present a certificate signed by a CA that Tomcat trusts. To enable it:Set certificateVerification on SSLHostConfig
Use
required to mandate client certificates or optional to accept them when present:Redirecting HTTP to HTTPS
Use a two-step approach: mark the HTTP Connector with aredirectPort, then declare a CONFIDENTIAL transport guarantee in the web application’s web.xml.
Step 1 — HTTP Connector (already the default):
web.xml security constraint:
302 redirect to the same URL on the redirectPort. No external load-balancer or reverse-proxy configuration is required.