Last tested: November 10, 2026 · By Alex
SSL_ERROR_BAD_CERT_DOMAIN is the error code Firefox shows when a website sends a certificate that is not issued for the hostname in the address bar. The certificate itself can be genuine, trusted and in date. It simply names a different site, so Firefox refuses to treat the connection as secure.
You normally see it on a full-page warning titled Warning: Potential Security Risk Ahead. The code only appears after you click Advanced. This guide is written for that Firefox screen: how to read what Firefox tells you, how to tell a local problem from a server problem, and how to fix the certificate or server so the names match. If you came here from Chrome or Edge, the same mismatch is called NET::ERR_CERT_COMMON_NAME_INVALID, and that guide walks through the Chrome side in depth.
Quick Fix
If you are visiting the site:
- Click Advanced and read the line that starts with “The certificate is only valid for”. It tells you which name the server actually covers.
- Check the address for typos, an extra
www, or a staging or internal name you opened from an old bookmark. - Try the other form of the address (with or without
www) and a Private Window. - If only your computer fails, turn off VPN, proxy and antivirus HTTPS scanning, then retest.
If you own the site:
- Run
openssl s_clientwith-servernameand-verify_hostnamefor the exact failing name (commands below). - Reissue the certificate so it lists every hostname people open, including
wwwand subdomains. - Make sure the right virtual host, CDN record and IP address (including IPv6) answer for that hostname.
- Fix redirects that send visitors to a name the certificate does not cover.
What SSL_ERROR_BAD_CERT_DOMAIN Means in Firefox

During the TLS handshake the server sends its certificate. Firefox takes the hostname you typed, for example www.example.com, and looks for it in the certificate’s Subject Alternative Name (SAN) list. Modern browsers, Firefox included, rely on the SAN entries and do not fall back to the old Common Name field, so a certificate with the right Common Name but no matching SAN entry still fails.
The matching rules are strict:
- Exact names must match character for character.
example.comdoes not coverwww.example.com, and the reverse is also true. - Wildcards cover exactly one label.
*.example.commatchesshop.example.com, but notexample.comand notdev.shop.example.com. - IP addresses only match if the certificate lists that IP as an IP address entry. Opening
https://203.0.113.10on a server whose certificate names a domain always fails. - Internationalised domains are compared in their punycode form (
xn--...), so the certificate must contain that encoded name.
If none of the SAN entries match, Firefox stops with SSL_ERROR_BAD_CERT_DOMAIN. This is different from a broken chain or an expired certificate, which Firefox reports with other codes.
Firefox vs Chrome: Same Problem, Different Names
| Where you see it | Hostname mismatch is reported as |
|---|---|
| Firefox (desktop and Android) | SSL_ERROR_BAD_CERT_DOMAIN on “Warning: Potential Security Risk Ahead” |
| Chrome, Edge, Brave, Opera | NET::ERR_CERT_COMMON_NAME_INVALID on “Your connection is not private” |
| Safari | “This Connection Is Not Private” with a certificate name warning |
| curl | SSL: no alternative certificate subject name matches target host name |
| openssl s_client with -verify_hostname | Verify return code: 62 (hostname mismatch) |
Because Firefox uses its own certificate code base and its own settings for DNS, proxies and certificate exceptions, it can disagree with Chrome on the same computer. That makes the “works in Chrome, fails in Firefox” case worth checking separately, which this guide does below. For the general browser warning that both share, see Your Connection Is Not Private.
Other Firefox Certificate Codes You Might Confuse It With
SEC_ERROR_UNKNOWN_ISSUER– the name may be fine, but the issuer or chain is not trusted. See SEC_ERROR_UNKNOWN_ISSUER.SEC_ERROR_EXPIRED_CERTIFICATE– the certificate is out of date, or the device clock is wrong. Chrome calls this NET::ERR_CERT_DATE_INVALID.SSL_ERROR_RX_RECORD_TOO_LONG– the server is not speaking TLS on port 443 at all. See SSL_ERROR_RX_RECORD_TOO_LONG.PR_END_OF_FILE_ERROR– the connection closed during the handshake, often a proxy or cipher problem (Chrome reports a pure version or cipher failure as ERR_SSL_VERSION_OR_CIPHER_MISMATCH). See PR_END_OF_FILE_ERROR.
Read the Firefox Error Details First

Firefox gives you more information on its error page than most people use. Before changing anything, collect it:
- On the warning page, click Advanced. Firefox writes something like “Firefox does not trust this site because it uses a certificate that is not valid for www.example.com.” and often adds “The certificate is only valid for example.com” or a list of names.
- Click the Error code: SSL_ERROR_BAD_CERT_DOMAIN link. Firefox expands technical details: the URL, whether HSTS applies, and the certificate chain in PEM form. The Copy text to clipboard button is handy when you need to send this to a host or administrator.
- Click View Certificate. Firefox opens its certificate viewer (an
about:certificatepage). Check Subject Alt Names for the DNS names, Issuer Name for who issued it, and Validity for the dates.
How to read the result:
- The SAN list has
example.combut notwww.example.com: a coverage problem on the certificate. - The SAN list belongs to a completely different site or to the hosting company’s server name: the wrong virtual host or the wrong server is answering.
- The issuer is your antivirus, VPN, school or company firewall: something on your network is intercepting HTTPS.
- There is no “Accept the Risk and Continue” button: the site uses HSTS, which forbids exceptions. See HSTS Error for why Firefox removes the button.
Fixing SSL_ERROR_BAD_CERT_DOMAIN as a Visitor
1. Check the Exact Address
Look at the address bar, not the link you clicked. Old bookmarks often point to staging., old. or dev. names, a typo such as wwww, or a raw IP address. Type the main domain by hand and see whether the warning disappears.
2. Try a Private Window and Troubleshoot Mode
A Private Window (Ctrl+Shift+P or Cmd+Shift+P) ignores your cached site data and most extensions. If the site loads there, clear cookies and site data for that domain. If you suspect an add-on, open Help → Troubleshoot Mode, which starts Firefox with extensions disabled.
3. Compare Firefox DNS With Your System DNS
Firefox can use its own encrypted DNS (Settings → Privacy & Security → DNS over HTTPS). If it is on, Firefox may resolve the name differently from Chrome or your operating system. This matters for split-horizon setups: an internal hostname resolved by a public DNS provider can lead you to a different server with a different certificate. Switch DNS over HTTPS to Off or Default Protection for a test, restart Firefox and retry. If the error goes away, the problem is which server the name resolves to, not the certificate on the right server.
4. Check Firefox Proxy Settings and Security Software
Firefox has its own proxy settings under Settings → General → Network Settings. Set them to No proxy or Use system proxy settings for a test. Then pause the VPN and any antivirus feature called HTTPS scanning, web shield or encrypted connection scanning. If the issuer in the certificate viewer was a security product, this step usually solves it.
5. Remove an Old Certificate Exception
If you once clicked “Accept the Risk and Continue”, Firefox stored a server exception. After the site changes, that stale exception can confuse testing. Open Settings → Privacy & Security → Certificates → View Certificates → Servers, select the entry for the site and click Delete, then reload.
6. Try Another Network or Device
Load the same address on mobile data or another device. If it fails everywhere, only the site owner can fix it. If it fails only on your network, the router, captive portal or company proxy is the likely cause.
Should You Click Accept the Risk and Continue?
Only for a device you manage yourself, such as a router or NAS panel opened by IP address, and only when you know why the name does not match. Do not enter passwords or payment details on a public website showing this warning. The mismatch means Firefox cannot confirm you are talking to the real server.
Fixing SSL_ERROR_BAD_CERT_DOMAIN on Your Server

Step 1: See Which Certificate the Hostname Really Gets
Test the exact name that fails, with SNI, and let OpenSSL check the hostname for you:
# Replace www.example.com with the failing hostname
openssl s_client -connect www.example.com:443 -servername www.example.com \
-verify_hostname www.example.com </dev/null 2>/dev/null | grep "Verify return code"
# Show who the certificate is for
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -ext subjectAltNameVerify return code: 62 (hostname mismatch) confirms the problem from outside the browser. A 0 (ok) result while Firefox still complains points back to the visitor checks above (DNS over HTTPS, proxy, interception).
curl gives the same answer in one line: curl -sv https://www.example.com/ -o /dev/null fails with “no alternative certificate subject name matches target host name” when the name is missing.
Step 2: Add Every Hostname to the Certificate
List the names people actually use: the bare domain, www, and any subdomains such as shop, mail or cdn. Then make sure the certificate includes all of them. With Certbot:
# See which names your current certificates cover
sudo certbot certificates
# Reissue with every hostname (Nginx plugin; use --apache for Apache)
sudo certbot --nginx -d example.com -d www.example.com -d shop.example.com
# Or add a name to an existing certificate
sudo certbot certonly --expand -d example.com -d www.example.comOn cPanel, check that the subdomain or www record exists and points to the account, then run AutoSSL again from SSL/TLS Status. On Hostinger hPanel, reinstall the free SSL for the domain after adding the subdomain. Remember that a wildcard only covers one level, so dev.shop.example.com needs its own name or its own wildcard *.shop.example.com.
Step 3: Make Sure the Right Virtual Host Answers
On a server with several sites, a hostname that is not listed in any HTTPS server block falls through to the default site, and Firefox receives that site’s certificate. Check which block owns the name:
# Nginx: show server names and certificates
sudo nginx -T 2>/dev/null | grep -E "server_name|listen .*443|ssl_certificate "
# Apache: list virtual hosts on port 443
sudo apachectl -SAdd the missing name to server_name (Nginx) or ServerAlias (Apache) in the HTTPS block that has the right 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;
}<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>Test and reload with sudo nginx -t && sudo systemctl reload nginx or sudo apachectl configtest && sudo systemctl reload apache2.
Step 4: Check A and AAAA Records Point to the Same Server
A classic cause after a migration: the A record was updated to the new host, but an old AAAA (IPv6) record still points to the previous server. Visitors on IPv6, and Firefox when it prefers IPv6, reach the old machine and get its certificate, which may name a different domain. Compare both:
dig +short A www.example.com
dig +short AAAA www.example.com
# Test the certificate on each address separately
curl -4 -sv https://www.example.com/ -o /dev/null 2>&1 | grep -i "subject\|subjectAltName\|no alternative"
curl -6 -sv https://www.example.com/ -o /dev/null 2>&1 | grep -i "subject\|subjectAltName\|no alternative"Delete or correct the stale record. If DNS was changed recently, also read Website Not Working After DNS Change, because some visitors will keep the old address until caches expire.
Step 5: Check Cloudflare or CDN Coverage
If the site is behind Cloudflare, a record set to DNS only (grey cloud) sends Firefox straight to your origin, which may carry a certificate for a different name or a Cloudflare Origin CA certificate. Switch the record to Proxied, or install a public certificate for that name on the origin. Universal SSL covers the apex and one level of subdomains, so a name like dev.www.example.com needs Advanced Certificate Manager, Total TLS or its own origin certificate. The Cloudflare-side checks are covered in detail in the ERR_CERT_COMMON_NAME_INVALID guide.
Step 6: Fix Redirects That Land on an Uncovered Name
Sometimes the first hostname is fine and a redirect sends Firefox to one that is not. Follow the chain:
curl -sIL http://example.com | grep -iE "^(HTTP|location)"
# WordPress: check the stored site addresses
wp option get home
wp option get siteurlMake every Location header end on a covered hostname. Correct rules in .htaccess, Nginx return 301 lines and CDN redirect rules, and update the WordPress Address and Site Address under Settings → General. If the redirects start looping after an HTTPS change, see Too Many Redirects After SSL.
Step 7: Retest in Firefox Without Cached Results
Firefox can reuse an existing connection for a short time. After fixing the server, close all tabs for the site, open a Private Window and load the exact hostname again. Then run an external check such as SSL Labs so you know the internet sees the new certificate, not only your own computer.
Why It Works in Chrome but Not in Firefox
Because both browsers apply the same hostname rules, a real certificate mismatch fails in both. When only Firefox fails, look at what Firefox does differently on that machine:
| Firefox-only cause | How to check |
|---|---|
| DNS over HTTPS resolves the name to another server | Turn DNS over HTTPS off and retry |
| Firefox proxy setting differs from the system | Network Settings → No proxy |
| Stale server exception from an earlier visit | View Certificates → Servers → Delete |
| Different IP family (IPv6 vs IPv4) reached | Compare curl -4 and curl -6 |
| Enterprise policy or security software for Firefox only | Check about:policies and the certificate issuer |
If the reverse happens and only Chrome complains, use the Chrome checklist in Why a Website Is Not Loading in One Browser Only.
Prevention Tips
- Keep a written list of every hostname that serves HTTPS and check it whenever you renew or replace a certificate.
- Issue certificates for both
example.comandwww.example.comeven if one only redirects; the redirect itself happens over HTTPS. - Remove A and AAAA records for old servers during migrations instead of leaving them in place.
- Give every site its own HTTPS server block and set a deliberate default site that does not expose another customer’s certificate.
- Run
openssl s_client -verify_hostnamefor each name in a monitoring script after renewals. - Avoid putting internal or staging hostnames in redirects, canonical tags or WordPress settings.
When to Contact Support
Contact your hosting provider if the certificate on the server names their own hostname, AutoSSL refuses to include a subdomain, or you cannot edit the web server configuration. Contact your CDN provider if the edge certificate does not cover the hostname even though the record is proxied. If the issuer is a company firewall or school network, the network administrator has to fix it. In each case, send the hostname, the time of the test and the text copied from the Firefox technical details.
Frequently Asked Questions
Firefox received a certificate that does not list the hostname you opened. The certificate can be valid and trusted, but it was issued for a different name, so Firefox blocks the connection.
Yes, they describe the same hostname mismatch. Firefox reports it as SSL_ERROR_BAD_CERT_DOMAIN and Chrome, Edge and other Chromium browsers report it as NET::ERR_CERT_COMMON_NAME_INVALID.
Click Advanced on the warning page, then View Certificate. The Subject Alt Names section lists every DNS name the certificate is valid for. Firefox also often states the valid name directly under Advanced.
The certificate covers only one form of the name. Reissue it with both example.com and www.example.com, and make sure both names point to the server that holds that certificate.
Firefox can use its own DNS over HTTPS, its own proxy settings and its own stored certificate exceptions. Any of these can send Firefox to a different server or keep an outdated result. Turn them off one by one and retest.
Only on a device you control, such as a router opened by IP address. On a public website the mismatch means Firefox cannot confirm the server, so do not log in or pay there.
Final Summary
SSL_ERROR_BAD_CERT_DOMAIN is Firefox telling you the certificate names a different host. Read the Advanced details and the certificate viewer first, rule out Firefox-specific DNS, proxy and exception settings, then fix the server side: add every hostname to the certificate, make the right virtual host and IP addresses answer, keep CDN records proxied and send redirects only to covered names.
Related SSL Errors
- ERR_CERT_COMMON_NAME_INVALID — the Chrome version of this error
- SEC_ERROR_UNKNOWN_ISSUER (Firefox)
- SSL_ERROR_RX_RECORD_TOO_LONG (Firefox)
- PR_END_OF_FILE_ERROR (Firefox)
- Your Connection Is Not Private
- NET::ERR_CERT_DATE_INVALID
- HSTS Error
- SSL Handshake Failed — Causes and Solutions
Hi, I’m Alex — the person behind ErrorRescue.
I’ve been working with websites, servers, and hosting for over 8 years. Most of my experience comes from troubleshooting real problems on WordPress sites, VPS and shared hosting environments, and Cloudflare setups. I’ve dealt with everything from SSL certificate failures and DNS misconfigurations to 504 timeouts, memory exhaustion errors, and Cloudflare 5xx issues.
I started ErrorRescue because I got tired of seeing generic, outdated, or incomplete error guides. My goal is to write clear, practical fixes based on what actually works in production — not just theory. Every guide here is tested against common server setups (Apache, NGINX, Cloudflare, and popular WordPress stacks).
When I’m not fixing sites, I’m usually reviewing new hosting configurations or updating existing guides so they stay accurate.
