Next Practical Step
Use the DNS Cache Manager to map the certificate’s valid domain name to the target IP address instead of using the raw IP in HTTP samplers.
Fix JMeter SSLPeerUnverifiedException and Certificate Hostname Mismatch errors. Configure TLS truststores, SNI, and SSL context properties in JMeter.
When sending HTTPS requests in View Results Tree, JTL results, or jmeter.log, samplers fail with:
Response code: Non HTTP response code: javax.net.ssl.SSLPeerUnverifiedExceptionResponse message: Non HTTP response message: Hostname api.internal.corp not verified: certificate: sha256/... DN: CN=*.prod.example.com subjectAltNames: [*.prod.example.com, prod.example.com]Or when hitting an HTTPS IP address directly:
javax.net.ssl.SSLPeerUnverifiedException: Certificate for <192.168.1.50> doesn't match any of the subject alternative names: [api.example.com]The TLS handshake fails before any HTTP request headers or body payload are sent.
SSLPeerUnverifiedException occurs when the server presents an SSL/TLS certificate whose Subject Common Name (CN) or Subject Alternative Names (SAN) do not match the hostname configured in JMeter’s HTTP Request sampler, or when SNI (Server Name Indication) is omitted.
| Cause | Why it happens |
|---|---|
| Direct IP addressing over HTTPS | HTTP Sampler points to 10.0.1.5 instead of api.example.com, but the TLS cert only contains the domain name |
| Wildcard certificate mismatch | Domain has multiple subdomains (e.g. a.b.example.com) but the cert is only valid for single-level *.example.com |
| SNI (Server Name Indication) missing | Server hosts multiple virtual hosts on one IP; TLS handshake receives the default certificate instead of the target domain cert |
| Incomplete certificate chain | Server does not send intermediate CA certificates during TLS negotiation |
| Cached SSL context reuse | JMeter shares an outdated or incorrect SSL context across multiple iterations |
If testing staging environments, do not enter the raw IP address into the “Server Name or IP” field of the sampler if the server presents a certificate for staging.example.com.
Use the actual domain name in the sampler and route it via the DNS Cache Manager or local /etc/hosts file:
# Add to DNS Cache Manager -> Custom DNS:Host: staging.example.comIP: 10.0.1.5system.propertiesTo manage SSL/TLS trust and hostname verification behavior, add these properties to bin/system.properties or pass them via CLI:
# Enable Server Name Indication (SNI) for modern TLS hostsjsse.enableSNIExtension=true
# Force specific TLS protocol version if server rejects TLS 1.3https.protocols=TLSv1.2,TLSv1.3When testing applications with client certificates or multiple domains, ensure SSL state is cleared between iterations in user.properties:
# Reset SSL context per iteration (useful for client certs and dynamic TLS)https.use.cached.ssl.context=falseIf using internal private CAs or self-signed certificates:
# Launch JMeter with explicit truststore containing the internal CAjmeter -n -t test.jmx \ -Djavax.net.ssl.trustStore=/path/to/truststore.jks \ -Djavax.net.ssl.trustStorePassword=changeit \ -l results.jtl -j jmeter.logVerify what domains the target certificate actually supports:
openssl s_client -connect api.example.com:443 -servername api.example.com </dev/null 2>/dev/null \ | openssl x509 -noout -text | grep -A1 "Subject Alternative Name"| Resource | Use when |
|---|---|
| SSLHandshakeException | PKIX path building and untrusted CA failures |
| ConnectException | Port 443 closed or unreachable |
| Non HTTP response code | General client-side exception triage |
| Properties Cheat Sheet | Full reference for SSL and TLS system properties |
While JMeter provides trust-all behavior for self-signed certificates in some samplers, modern Java and HttpClient4 strictly enforce SAN hostname matching for HTTPS security. The cleanest and most realistic approach is to map the hostname to the target IP using a DNS Cache Manager.
Local machines often have corporate root certificates installed in the OS keychain or local hosts mapped in /etc/hosts, while clean CI/CD container runners lack those custom configurations.