← Back to Learning Hub

DNS • Intermediate • 5 min read

Fix ERR_CERT_COMMON_NAME_INVALID (Name Mismatch)

ERR_CERT_COMMON_NAME_INVALID means the hostname is not in the certificate's SAN list. Why browsers ignore CN, what triggers the mismatch, and how to fix it.

NET::ERR_CERT_COMMON_NAME_INVALID in Chrome, or SSL_ERROR_BAD_CERT_DOMAIN in Firefox, means the certificate is otherwise valid but does not cover the hostname you typed. The browser reached a server with a real, trusted, unexpired certificate, but that certificate is for a different name, so it refuses the connection as a possible identity mismatch. The error name mentions the Common Name for historical reasons, but the actual check modern browsers run is against the Subject Alternative Name list. Getting the fix right starts with understanding that distinction.

Browsers check the SAN, not the CN

Every certificate has a legacy Common Name (CN) field in its subject, and it also has a Subject Alternative Name (SAN) extension listing the hostnames it is valid for. For years browsers would fall back to the CN, but that stopped: Chrome removed CN fallback in version 58, and other major browsers followed. Today a certificate is valid for a hostname only if that exact name (or a matching wildcard) appears in the SAN list. The CN is effectively decorative. So even a certificate whose CN reads "example.com" will throw this error for example.com unless example.com is also in the SAN.

That is why the fix is almost never "change the CN." It is "make sure the hostname you are visiting is in the SAN list," which means reissuing the certificate with the right names or pointing the visitor at a hostname the certificate already covers.

What triggers a name mismatch

A handful of patterns cause the overwhelming majority of these errors.

www versus apex. The certificate covers example.com but the visitor requested www.example.com, or the reverse. These are two distinct SAN entries; covering one does not cover the other. You either add both names to the certificate or redirect one host to the other at the HTTP layer.

Wildcard scope misunderstanding. A wildcard like *.example.com matches one label: www.example.com and api.example.com, but not the bare example.com, and not a deeper name like a.b.example.com. Expecting a wildcard to cover the apex or a multi-level subdomain is a frequent cause.

Wrong virtual host or SNI. When several sites share one IP, the server picks which certificate to present based on the SNI value in the TLS handshake. A missing default certificate, a typo in a server-name directive, or an old client that does not send SNI can cause the server to hand back the wrong site's certificate, producing a mismatch for a name that is actually configured somewhere on the box.

Accessing by IP or internal name. Visiting https://203.0.113.10 directly, or an internal hostname that is not in the SAN, triggers the error because public certificates almost never list raw IPs or internal names.

How to diagnose and fix it

First, read the certificate's actual SAN list and compare it to the hostname in the address bar. You can pull the SAN with openssl:

openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -text | grep -A1 "Subject Alternative Name"

That prints the DNS names the certificate covers. The quicker path is the Valla DNS SSL checker, which lists every SAN entry alongside the hostname you tested so you can see at a glance whether it is covered.

Once you know the gap, pick the matching fix. If the hostname simply is not on the certificate, reissue the certificate with all the names you serve in the SAN (for example both example.com and www.example.com). If the certificate already covers the canonical host, add an HTTP redirect so the uncovered variant sends visitors to the covered one. If the SAN looks correct but the wrong certificate is being served, the problem is virtual-host or SNI configuration: confirm the right server block owns the hostname and that a sensible default certificate is set for non-SNI clients.

When you suspect SNI is the issue, test it directly. Running openssl s_client -connect example.com:443 -servername example.com and then the same command with a different -servername value shows whether the server hands back a different certificate depending on the name requested. If one SNI value returns the right certificate and another returns a fallback for an unrelated site, the vhost that should own your hostname is missing or misconfigured. Fix the server block so the correct name maps to the correct certificate, and set an explicit default so clients that request an unknown name get a sane certificate rather than a confusing mismatch.

Frequently asked questions

Why does the error say Common Name if browsers ignore the CN?

The error string is historical. The check behind it is against the Subject Alternative Name list. Chrome kept the old name even though CN fallback was removed in version 58, so treat the message as "hostname not in the SAN."

My certificate's CN is correct. Why the mismatch?

Because the CN is not what is checked. The hostname must appear in the SAN extension. Reissue the certificate so every name you serve is listed as a SAN entry; the CN alone does not satisfy modern browsers.

Does a wildcard certificate cover my apex domain?

No. *.example.com covers single-label subdomains like www.example.com but not the bare example.com and not deeper names like a.b.example.com. Add the apex explicitly if you need it covered.

The site loads on www but fails on the bare domain. Why?

The certificate lists one but not the other, or the apex is served by a host without the right certificate. Add both names to the SAN, or redirect the uncovered variant to the covered one.

How do I see exactly which names my certificate covers?

Read the SAN list. Use openssl x509 -noout -text on the presented certificate, or run the hostname through an SSL checker that prints every SAN entry so you can match it against the address you are visiting.

A common-name error is a coverage problem: the certificate is valid, just not for the name you used. Confirm exactly which hostnames your certificate lists by running it through the Valla DNS SSL checker, then add the missing name or redirect to a covered one.

Troubleshooting box

If results look inconsistent, compare authoritative nameservers first, then recursive resolvers by region. Capture snapshots every 10 minutes for deterministic incident timelines.

Try VallaDNS free →

Intermediate • 6 min

Fix ERR_NAME_NOT_RESOLVED in Your Browser

ERR_NAME_NOT_RESOLVED means the browser could not turn a hostname into an IP. Separate a missing record from a stale cache, a down resolver, or a typo, and fix each.

Intermediate • 6 min

What Is TLS-RPT? Reading TLS Reporting Reports

TLS-RPT publishes a _smtp._tls TXT record so receivers send you daily JSON reports on successful and failed TLS sessions. Learn what the reports contain and how to act on them.