Inbound TLS
Accept HTTPS requests from clients connecting to MockServer.
Inbound mTLS
Require connecting clients to present a valid X.509 certificate.
Outbound TLS
Connect to HTTPS backends when forwarding or proxying requests.
Trusting MockServer’s certificate
MockServer dynamically generates its TLS certificates, signed by its own Certificate Authority (CA). HTTP clients must trust this CA to establish a TLS connection without errors.Add the CA to the JVM trust store
Use the Javakeytool command to import the MockServer CA certificate:
Configure the SSL socket factory in tests
For Java test suites, configure the default SSL socket factory to accept MockServer certificates:Inbound TLS configuration
Use a dynamically generated CA
By default, MockServer uses a fixed built-in CA. Enable this property to generate a unique CA certificate and private key on first startup instead:Use a custom CA certificate
To sign MockServer’s generated certificates with your own CA, provide both a private key and X.509 certificate in PEM format:Use a fixed server certificate
To use a specific certificate for all TLS connections into MockServer rather than having one generated, provide both the private key and X.509 certificate:certificateAuthorityCertificate must be the CA that signed this X.509 certificate.
Configure Subject Alternative Names
MockServer automatically updates the Subject Alternative Names (SANs) in its certificate as it sees new hostnames. To lock down SANs to a fixed list:Inbound mTLS (client certificate authentication)
Require all clients connecting to MockServer to present a valid certificate signed by a trusted CA:tlsMutualAuthenticationCertificateChain is the PEM file containing the CA (or chain) that signed trusted client certificates. Any client presenting a certificate not signed by this CA will be rejected.
When
tlsMutualAuthenticationRequired is enabled, the tlsMutualAuthenticationCertificateChain is also used by MockServerClient when it connects to MockServer over TLS.