SSL / monitoring TECHNICAL HANDBOOK / 2026

SSL ERRORS

hostname mismatch: causes and fixes

The certificate failed OpenSSL’s hostname check. Compare its SANs with the requested name and confirm that SNI selects the right virtual host.

What it means

A direct IP test can reach the right machine while selecting the wrong virtual host. Conversely, sending the expected SNI may still return a certificate that lacks the required SAN. Keep connection routing, SNI selection and certificate-name verification as separate facts.

What to check

  1. Record the intended hostname, destination IP and SNI value.
  2. Inspect the presented SANs and compare with the exact requested DNS name.
  3. Repeat using -servername and -verify_hostname with the same intended hostname.

Test the connection

openssl s_client -connect www.example.com:443 -servername www.example.com \
  -verify_hostname www.example.com -verify_return_error </dev/null

Run this OpenSSL 3.x example in a POSIX shell. Keep the hostname, peer address and full verification result with the error report.

Choose Windows, macOS or Linux commands →

How to fix it

  1. Correct virtual-host selection or an unintended DNS destination if it serves the wrong identity.
  2. Obtain and deploy a certificate that covers the intended DNS name when the SAN list is incomplete.
  3. Retest aliases independently; a wildcard only covers one label beneath the domain.

Check the fix

The connection must pass the explicit identity and trust checks with the intended hostname. Keep the hostname even when changing the target address to isolate a particular backend.

Details worth checking

Send both -servername and -verify_hostname. The first selects the virtual host; the second checks the certificate’s identity.

Related guides

Related errors

References