Hostname Mismatch: SSL Common Name and SAN Errors

A hostname mismatch (ERR_CERT_COMMON_NAME_INVALID) means the certificate does not cover the hostname you are visiting. Modern browsers match only the certificate's Subject Alternative Names (SANs) and ignore the legacy Common Name (CN) field, as standardized in RFC 9525 (2023), which obsoleted RFC 6125. A certificate for example.com does not cover www.example.com — they are different hostnames. The fix is almost always to reissue the certificate with the exact hostnames you serve, including the www prefix if you redirect to it, and deploy the new certificate with its full chain, not to change server configuration.
RFC 9525 §6.3: the CN-ID MUST NOT be used for identity matching. Chrome 58 (2017) removed the CN fallback.
How hostname validation works
The browser compares the hostname you visit against the certificate's SAN entries and requires at least one exact match (including wildcard rules). RFC 9525 requires that the CN not be used for identity matching; Chrome stopped falling back to the CN in Chrome 58 (2017). That is why legacy "CN-only" certificates fail on modern browsers.
Wildcard vs multi-domain (SAN) certificates
A wildcard *.example.com covers only one level of subdomains (such as www.example.com); it does not cover example.com itself, nor deeper names like a.b.example.com. A SAN (multi-domain) certificate can list several unrelated hostnames explicitly. If you need both example.com and www.example.com, request a SAN certificate containing both, or combine a wildcard with the bare domain.
The correct fix direction
Reissue the certificate for the hostnames you actually serve and deploy the full chain. Inspect the served SANs with openssl x509 -in cert.pem -noout -text | grep -A1 "Subject Alternative Name". Do not "work around" it with URL rewrites or redirects — the certificate must cover the hostname visitors actually connect to, or every client will keep erroring.
Step 1: Identify the reported hostname
Read the exact fully-qualified domain (with subdomain) from the error page. Make sure it is not a typo or a misconfiguration that redirected you to a different host.
Step 2: Inspect the certificate's current SANs
Use the Certificate Decoder or the openssl command above to list the certificate's real SANs and confirm which hostname is missing.
Step 3: Reissue for the correct hostnames
Use the CSR Generator to create a CSR covering every required hostname (including www), then submit it to your CA for a SAN certificate. Internal services can instead use a private CA for batch issuance.
Step 4: Deploy the full chain and re-check
Deploy the new certificate plus its intermediate chain, then re-check hostname coverage with the SSL Checker. Where useful, set a 301 redirect between www and the bare domain to unify the entry point.
Troubleshooting checklist
| Symptom | Likely cause | What to do |
|---|---|---|
| ERR_CERT_COMMON_NAME_INVALID | SAN lacks the current hostname | Reissue for the real domain and write the SAN |
| example.com works but www fails | They are different hostnames | Cover both in the SAN or redirect |
| *.example.com misses the bare domain | Wildcard excludes bare domain | Add bare domain to SAN or redirect |
| Old cert fails on new browsers | CN only, no SAN | Reissue a SAN-bearing certificate |
| Multiple subdomains fail one by one | No SAN multi-domain cert used | Switch to a SAN certificate |
| Still fails after config change | Old certificate still deployed | Reload/restart the service and clear cache |
Tools & further reading
- CSR Generator: create a certificate signing request with multiple SANs
- Certificate Decoder: inspect the certificate SAN and validity
- SSL Checker: re-verify hostname coverage
- SSL certificate guide: complete tutorial from selection to deployment
- Related: Fix "Your Connection Is Not Private", Fix an Incomplete Certificate Chain, Fix SSL Handshake Failed
FAQ
Why did the certificate work before but not now?
Older browsers and systems fell back to the CN field when SANs were absent. Modern browsers follow RFC 9525 (2023) and honor only SANs, so old CN-only certificates now fail.
Does the www prefix really matter?
Yes. example.com and www.example.com are different hostnames. Use a SAN certificate or wildcard that covers both, or redirect one to the other with a 301.
Does a wildcard cover all subdomains?
Only one level: *.example.com covers www.example.com but not the bare example.com, nor a.b.example.com. Deeper levels must be added to the SAN explicitly.
Can a server redirect solve the mismatch?
A redirect changes which hostname the user reaches, but not which hostname the certificate covers. The certificate must cover the hostname the visitor ultimately connects to; redirection is only an aid to unify the entry point.
Free SSL/TLS tools
Verify and inspect your certificates in seconds.
Related Certificate Info
Learn more about choosing and buying certificates.