Why browsers and curl reject a certificate that does not match the hostname (ERR_CERT_COMMON_NAME_INVALID, no alternative certificate subject name matches), how SAN and wildcard matching work, and how to find and fix the wrong certificate.
Home › Guides › SSL certificate name mismatch
Last updated 18 November 2026
The server presented a certificate that doesn't list the name you connected to. Clients match the hostname against the DNS names in the certificate's Subject Alternative Name (SAN) extension, not the Common Name: RFC 9525 says the Common Name MUST NOT be used to identify a service, and the CA/Browser Forum Baseline Requirements make subjectAltName mandatory in publicly trusted server certificates (for DV, IV and OV certificates a commonName is NOT RECOMMENDED and, if present, must come from the SAN). It is almost always one of these:
www.example.com but not example.com, or a new subdomain was added later. Fix: reissue the certificate with every name.| Client | Error | Source |
|---|---|---|
| Chrome and Chromium browsers | NET::ERR_CERT_COMMON_NAME_INVALID (net error -200) | Chromium describes it as a certificate whose common name did not match the host name. |
| curl (OpenSSL builds) | SSL: no alternative certificate subject name matches target hostname 'www.example.com' | curl's OpenSSL backend; releases such as 7.88.1 write target host name. Exit code 60 (CURLE_PEER_FAILED_VERIFICATION). |
| curl, certificate with no DNS or IP SAN | SSL: certificate subject name '...' does not match target hostname '...' | curl only falls back to the subject CN when the certificate has no DNS or IP SAN entries. |
| Node.js | ERR_TLS_CERT_ALTNAME_INVALID | The host name/IP of the peer did not match any of the subjectAltNames in its certificate. |
| OpenSSL | X509_V_ERR_HOSTNAME_MISMATCH: hostname mismatch | X509_STORE_CTX_get_error(3). |
Chromium's source lists four possible reasons for -200: an attacker redirected traffic to their own server; the server is misconfigured and responding with the wrong certificate; you're on a wireless network that redirects to its login page; or the operating system added a DNS search suffix and the server has no certificate for the short name you typed.
*. So *.example.com matches www.example.com but not example.com and not a.b.example.com. The nginx documentation gives a matching example (*.example.org matches www.example.org but not example.org or www.sub.example.org) and suggests listing both example.org and *.example.org in the SAN.echo | openssl s_client -connect www.example.com:443 -servername www.example.com 2>/dev/null | openssl x509 -noout -subject -issuer -ext subjectAltName
-ext subjectAltName prints the SAN list (the OpenSSL x509 manual uses exactly this example). If the name you need isn't there, you have cause 1 or cause 2. To have OpenSSL do the check for you:
openssl s_client -connect www.example.com:443 -servername www.example.com -verify_hostname www.example.com -verify_return_error openssl x509 -in cert.pem -noout -checkhost www.example.com
-verify_hostname checks the name during the handshake and -verify_return_error makes s_client stop on the failure (by default it carries on after verification errors). -checkhost tests a certificate file before you install it. For a mail server add -starttls smtp and connect to port 25.
A server hosting several HTTPS sites on one IP picks the certificate from the SNI name the client sends in the handshake. The nginx documentation explains that without it the server can only offer the default server's certificate, because the TLS connection is set up before the HTTP request names the site. OpenSSL's s_client sends SNI from the -connect name when it's a DNS name, or the value of -servername. Compare:
openssl s_client -connect www.example.com:443 -servername www.example.com openssl s_client -connect www.example.com:443 -noservername
If the second command returns a different certificate, the server has more than one and the name you need isn't mapped to the right one, or an old client isn't sending SNI. nginx notes SNI is mandatory to implement in TLS 1.3 but may not be used by some old or special clients, and only domain names can be sent in SNI, not IP addresses.
If some users see the error and others don't, one IP behind the name may be serving an old or default certificate. Test each address while keeping the real hostname for SNI and verification:
curl -sv --resolve www.example.com:443:203.0.113.10 https://www.example.com/ -o /dev/null openssl s_client -connect 203.0.113.10:443 -servername www.example.com
curl's --resolve forces the address for that host and port, and --connect-to changes only where curl connects, not the name used for SNI and certificate checks. Find every A and AAAA record with the DNS Lookup and confirm a DNS change reached public resolvers with the DNS Propagation Checker.
www if both are used, then install it on every server and load balancer behind those names. The SSL Certificate Checker shows the SAN names and wildcard flag of every current certificate issued for a domain, which helps spot a renewal that dropped a name.-k/--insecure makes the transfer insecure, because curl then doesn't check the name or the CA.The Bulk SSL Certificate Expiry Monitor on Apify connects to each server and reads the certificate it is serving right now, on any port, including SMTP, IMAP and POP3 STARTTLS. It checks every IP behind a name, flags hostname mismatches, untrusted chains and weak keys, and can run on a schedule ($1 per 1,000 endpoints).
Check issued certificates, SAN names and expiry dates with the SSL Certificate Checker, find every A, AAAA and CAA record with DNS Lookup, confirm DNS changes with the DNS Propagation Checker, find dangling names with the Subdomain Takeover Checker and check mail hosts with the MX Record Lookup and MTA-STS Checker. Related guides: SSL certificate has expired, unable to get local issuer certificate, SSL wrong version number, SSL handshake failure and protocol version and MTA-STS and TLS-RPT setup.
Chrome received a certificate that does not list the hostname in the address bar. Despite the name, modern clients check the Subject Alternative Name entries, not the Common Name. Usually the name is missing from the certificate or the server sent the wrong certificate.
None of the DNS or IP entries in the certificate Subject Alternative Name match the host in your URL. Print them with openssl x509 -noout -ext subjectAltName and reissue the certificate or fix the server so it serves the right one.
No. A wildcard such as *.example.com matches exactly one label, so it covers www.example.com but not example.com or a.b.example.com. List both example.com and *.example.com in the SAN if you need both.
Often one IP address or load balancer node behind the name still serves an old or default certificate, or an old client does not send SNI. Test each IP with curl --resolve or openssl s_client -servername.
Not by modern clients. RFC 9525 says the Common Name must not be used to identify a service, and the CA/Browser Forum requires a subjectAltName in public server certificates. curl only falls back to the CN when the certificate has no DNS or IP SAN.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.