Skip to content

Troubleshooting guide

NET::ERR_CERT_COMMON_NAME_INVALID: how to fix it

The certificate is valid, but not for the name in the address bar. It is a mismatch between the hostname and the certificate's listed names.

3 min read10 sectionsUpdated

On this page

Key points

  • Browsers check the Subject Alternative Names, not the old common name field.
  • www and the bare domain are separate names unless both are listed.
  • A wildcard covers one level only.
  • A wrong default site in Nginx serves another domain's certificate.

What the error means

Browsers compare the hostname you visited with the DNS names in the certificate's Subject Alternative Name list. If none match, Chrome shows this error, even when the certificate is otherwise valid and trusted.

Common causes

  • example.com is covered, but www.example.com is not, or the reverse.
  • A new subdomain was added after the certificate was issued.
  • Wildcard limits. *.example.com covers app.example.com but neither example.com nor a.b.example.com.
  • The server's default site answers for an unknown name, and sends its own certificate.
  • DNS pointing at a shared host or CDN that has no certificate for your domain.

Diagnose it

List the names in the certificate actually served for that hostname. -servername matters: without it, a shared server may return a different certificate.

bash
# Names the certificate covers
openssl s_client -connect example.com:443 -servername www.example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -ext subjectAltName

# Who is it for, and who issued it?
openssl s_client -connect example.com:443 -servername www.example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer

# Which Nginx server block is the default?
sudo nginx -T 2>/dev/null | grep -E 'server_name|default_server'

Fixes

Reissue the certificate with every name you serve. With Certbot, pass each one: certbot --nginx -d example.com -d www.example.com. Add a matching server_name block for each host so the right certificate is presented. If you do not intend to serve a hostname over HTTPS, remove its DNS record. On a CDN, make sure the custom hostname is added and its certificate is active before pointing DNS at it.

Catch it automatically

Each hostname needs its own check, because the apex can be perfectly healthy while www is broken. Add SSL monitoring for all public hostnames, and include hostnames used only by redirects, since visitors from old links reach those first.

Frequently asked questions

Does a certificate for example.com cover www?

Only if www.example.com is also listed. Most issuers add both when you ask, but it is not automatic.

Does a wildcard cover the root domain?

No. *.example.com does not include example.com, so list the root separately.

Why do I see another site's certificate?

The server has no matching configuration for your hostname, so it serves its default site.

Check it now, free

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.