Skip to content
RU

SSL_ERROR_BAD_CERT_DOMAIN in Firefox: How to Fix a Certificate Name Mismatch

Laptop in a dim room showing a browser security warning page with a yellow warning triangle

What it means: The certificate's Subject Alternative Name list does not include the hostname in Firefox's address bar.

  1. Check the exact address, including www
  2. Read the names Firefox says are valid
  3. If it fails everywhere: reissue with every hostname
  4. Fix the server's default SNI certificate

Test your URL now

Runs a full TLS check: handshake, protocol versions, certificate chain, trust and expiry.

Check your site's SSL →

What SSL_ERROR_BAD_CERT_DOMAIN means

During certificate validation Firefox compares the hostname you opened with the DNS names (or IP addresses, for an IP URL) in the certificate's subjectAltName extension. If none matches, it stops with SSL_ERROR_BAD_CERT_DOMAIN and explains: "Firefox does not trust this site because it uses a certificate that is not valid for" the hostname, often followed by the names the certificate is valid for. A wildcard such as *.example.com covers exactly one label: www.example.com matches, example.com and a.b.example.com do not.

This is an identity check at the TLS layer, not a DNS failure, although DNS often causes it by sending you to a server that holds another site's certificate. When a certificate is both expired and issued for the wrong name, Firefox reports the name problem first. The Chrome and Edge counterpart is NET::ERR_CERT_COMMON_NAME_INVALID.

Causes in Firefox, Chrome, Edge and Safari

BrowserWhat you seeMost common trigger
Firefox"Warning: Potential Security Risk Ahead", SSL_ERROR_BAD_CERT_DOMAINCertificate lacks the www or apex name; wrong virtual host certificate
Chrome"Your connection is not private", NET::ERR_CERT_COMMON_NAME_INVALIDSame
Edge"Your connection isn't private", NET::ERR_CERT_COMMON_NAME_INVALIDSame
Safari"This Connection Is Not Private"Same

Typical triggers: the certificate covers www.example.com but not example.com (or the reverse); a wildcard expected to cover the apex or a second-level subdomain; a new subdomain added without reissuing; a hostname with no TLS server block of its own, so the server falls back to its default certificate; an old A or AAAA record still pointing to a previous host or shared hosting; opening the site by IP address or by an internal short name.

Certificates that carry the name only in the Common Name field no longer work: Chrome stopped reading the Common Name in version 58, and Apple did the same in iOS 13 and macOS 10.15. The name must be in the SAN list. On captive Wi-Fi, the login portal can answer for every hostname with its own certificate, which also looks like a name mismatch.

Behind Cloudflare, nginx or another proxy

  • Cloudflare. Universal SSL covers the apex and first-level subdomains of a proxied zone. A multi-level name such as test.dev.example.com gets no edge certificate at all, so Firefox shows SSL_ERROR_NO_CYPHER_OVERLAP rather than BAD_CERT_DOMAIN; it needs an advanced or custom certificate. BAD_CERT_DOMAIN on a Cloudflare zone usually means the record is DNS only and the origin's own certificate lacks the name.
  • nginx. When the SNI name matches no server_name, nginx answers with the default_server block and its certificate. Since nginx 1.19.4 you can refuse unknown names instead of sending the wrong certificate:
server {
    listen 443 ssl default_server;
    ssl_reject_handshake on;   # unknown names get an alert, not a wrong certificate
}
server {
    listen 443 ssl;
    server_name example.com www.example.com;
    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
}

Visitors to an unknown name then see an unrecognized-name alert, which points straight at the missing server block. HAProxy and cloud load balancers behave like nginx: no SNI match means the default certificate.

If you own the site

  1. List the names on the certificate the server actually sends:
    openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
      | openssl x509 -noout -subject -ext subjectAltName
  2. Let OpenSSL check the name for you: add -verify_hostname www.example.com to s_client. A mismatch prints Verify return code: 62 (hostname mismatch).
  3. Check where each name resolves: dig +short example.com A, dig +short www.example.com A and the same with AAAA. An IPv6 address pointing at an old host is a frequent culprit.
  4. Reissue with every name you serve: sudo certbot --nginx -d example.com -d www.example.com (add --expand to grow an existing certificate). A Let's Encrypt wildcard needs DNS-01 validation and still does not cover the apex, so list both.
  5. Make sure the right server block owns each name, then sudo nginx -t && sudo systemctl reload nginx.

If you are a visitor

  • Check the address for a typo, a missing or extra www, or an old bookmark to a retired subdomain. If Firefox names the one hostname the certificate is valid for, it links to it; use that link if it is the site you meant.
  • On public Wi-Fi, complete the login page first, then reload.
  • If the error appears on every network for one site, only the owner can fix it.
  • "Accept the Risk and Continue" is offered unless the site uses HSTS. Skip it on any page where you log in or pay.

Clearing the cache or cookies does not change the result: the certificate is checked on each new connection, and it is not stored in the HTTP cache.

How to confirm the fix

for h in example.com www.example.com; do
  echo | openssl s_client -connect $h:443 -servername $h -verify_hostname $h 2>/dev/null \
    | grep "Verify return code"
done
# → Verify return code: 0 (ok) for each name

curl -sS -o /dev/null https://www.example.com/ && echo OK
# mismatch: curl: (60) SSL: no alternative certificate subject name matches target hostname

Then check each hostname from outside your network with the enterno.io SSL checker, which lists the SAN names on the served certificate.

Related errors

CertificateExpiry, issuer, domains (SAN)
ChainIntermediate and root CA validation
TLS ProtocolTLS version and cipher suite
VulnerabilitiesHeartbleed, POODLE, weak ciphers

Why teams trust us

TLS 1.3
supported
Full
CA chain check
3,158
checks in 30 days
30/14/7
days-to-expiry alerts

How it works

1

Enter domain

2

TLS chain verified

3

Expiry date & vulnerabilities

What Does the SSL Check Cover?

SSL/TLS is the encryption protocol that protects data between the browser and server. Our tool analyzes the certificate, chain of trust, TLS version, and knownvulnerabilities.

Certificate Details

Issuer, validity period, signature algorithm, covered domains (SAN), and validation type (DV/OV/EV).

Chain of Trust

Full chain verification: from leaf certificate through intermediates to root CA.

TLS Analysis

Protocol version (TLS 1.2/1.3), cipher suites, Perfect Forward Secrecy (PFS) support.

Expiry Alerts

Set up a monitor — get Telegram and email alerts 30/14/7 days before expiration.

DV vs OV vs EV Certificates

DV (Domain Validation)
  • Confirms domain ownership only
  • Issued in minutes automatically
  • Free via Let's Encrypt
  • Suitable for most websites
  • Most common certificate type
OV / EV
  • Organization (OV) or Extended Validation (EV)
  • Issued in 1-5 business days
  • Costs $50 to $500/year
  • For finance, e-commerce, government sites
  • Increases user trust

Who uses this

DevOps

SSL certificate monitoring

Security

TLS config audit

SEO

HTTPS as ranking factor

E-commerce

customer trust

Common Mistakes

Expired certificateBrowsers block sites with expired SSL. Set up auto-renewal or monitoring.
Incomplete certificate chainWithout intermediate CA, some browsers and bots cannot verify the certificate.
Mixed content on HTTPS siteHTTP resources on an HTTPS page — the browser lock icon disappears, reducing trust.
Using TLS 1.0/1.1Legacy TLS versions have known vulnerabilities. Use TLS 1.2+ or 1.3.
Domain mismatch in certificateThe certificate must cover all site domains, including www and subdomains.

Best Practices

Set up auto-renewalLet's Encrypt + certbot with cron — certificate renews automatically every 60-90 days.
Enable HSTSStrict-Transport-Security header forces browsers to always use HTTPS.
Use TLS 1.3TLS 1.3 is faster (1-RTT handshake) and safer — legacy ciphers removed.
Monitor expiration datesCreate a monitor on Enterno.io — get notified well before expiration.
Verify chain after renewalAfter certificate renewal, confirm that intermediate certificates are installed.

Get more with a free account

SSL certificate monitoring, check history and alerts 30 days before expiry.

Sign up free

Learn more

Sources

Frequently Asked Questions

Why does example.com fail when www.example.com works?

The certificate lists only www.example.com, or the apex is served by a different server block. Reissue the certificate with both names and check that both resolve to the same server.

Does a wildcard certificate cover example.com?

No. A wildcard like *.example.com matches exactly one label, such as www.example.com, but not the bare domain or a.b.example.com. Put example.com in the SAN list next to the wildcard.

Is it safe to click Accept the Risk and Continue?

Only when you know why the name differs, for example your own server opened by its IP address. On a public site a name mismatch can mean you reached the wrong server, so do not log in or pay.

Why do I see this error only on hotel or airport Wi-Fi?

The network intercepts HTTPS until you sign in and answers with its own certificate. Open any plain HTTP page to trigger the login portal, sign in, then reload.

Why does the error name a certificate for a completely different site?

The server had no TLS block for your hostname and fell back to its default certificate, or an old A or AAAA record sent you to a previous or shared host. Check DNS for both address types and add a server block for the name.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.