HSTS error in Chrome or Firefox: what it means and how to fix it
An HSTS error is the certificate warning that cannot be clicked past. Chrome says you cannot visit the site right now because it uses HSTS, and Firefox says you cannot add an exception. For a site owner that means visitors are locked out completely until the problem is fixed, and no setting on the page can let them through. The HSTS part of the message is not the fault; it is the reason there is no way round it. This guide explains what the error means, why browsers refuse a bypass, how to read the error code to find the real cause, and how to fix the expired, mismatched or untrusted certificate, or the includeSubDomains rule, behind it.
- What the HSTS error means
- Why visitors cannot bypass an HSTS error
- The usual causes and their error codes
- How to diagnose the HSTS error on your site
- Fixing the certificate on common servers and platforms
- When the cause is the visitor, not the site
- The fix, step by step
- Edge cases worth knowing
- Keeping HSTS errors away
- Questions and answers
What the HSTS error means
An HSTS error is a certificate error on a site that has told browsers to accept HTTPS only. The site, or a parent domain, sent a Strict-Transport-Security header on an earlier visit, or is on the browser's built-in preload list. Now the browser has found a problem with the certificate, and because of HSTS it will not let the visitor carry on.
The wording varies by browser, but the important part is the same: there is no way through.
| Browser | What the visitor sees |
|---|---|
| Chrome and Edge, desktop and Android | Your connection is not private, followed by: You cannot visit example.com right now because the website uses HSTS. There is no Proceed link under Advanced. |
| Firefox | Did Not Connect: Potential Security Issue, explaining that the site has a policy called HTTP Strict Transport Security and that you cannot add an exception. |
| Safari | This Connection Is Not Private, without the usual option to visit the website anyway. |
The HSTS part of the message is not the fault. It is the reason the visitor cannot bypass the fault. The fault itself is shown in the error code, such as NET::ERR_CERT_DATE_INVALID in Chrome or SEC_ERROR_UNKNOWN_ISSUER in Firefox, and that code tells you what to fix.
Why visitors cannot bypass an HSTS error
Without HSTS, a certificate warning has an Advanced or Accept the Risk option. That option is exactly what an attacker on public Wi-Fi relies on: present a fake certificate and hope the visitor clicks through. HSTS exists to close that gap, so browsers deliberately remove the option for HSTS sites. Nothing you put on the page can change this, because the browser stops before your page loads.
So the only real fix for an HSTS error on your own site is to fix the certificate problem underneath it. Telling visitors to clear their browser settings is not a fix: it removes their protection, it does not work for preloaded domains, and it is undone on their next visit when your site sends the header again.
If you are the visitor rather than the owner, and the error appears on a large site such as Google, the problem is almost certainly on your device or network. Large sites are preloaded and their certificates are monitored around the clock, so a genuine fault is rare. Check the causes in the visitor-side section below.
The usual causes and their error codes
| Error code | Meaning | Typical cause on your site |
|---|---|---|
NET::ERR_CERT_DATE_INVALID, SEC_ERROR_EXPIRED_CERTIFICATE | Certificate expired or not yet valid | Automatic renewal failed, or renewed but the server was not reloaded |
NET::ERR_CERT_COMMON_NAME_INVALID, SSL_ERROR_BAD_CERT_DOMAIN | Certificate is for a different host name | Certificate lacks www or the subdomain, or the server sent the default site's certificate |
NET::ERR_CERT_AUTHORITY_INVALID, SEC_ERROR_UNKNOWN_ISSUER | Browser cannot trace the certificate to a trusted root | Self-signed or panel default certificate, or a missing intermediate certificate |
| Same codes, on one subdomain only | A host covered by the parent's rule has no valid certificate | includeSubDomains on the apex catching a staging, mail or internal host |
The last row catches many site owners out. If example.com sends includeSubDomains, every visitor who has been to the main site also applies HSTS to staging.example.com, mail.example.com and anything else under the domain. A subdomain that always had a self-signed certificate, and was fine because people clicked through, suddenly cannot be opened at all.
The hostname mismatch guide and the untrusted certificate guide go into the second and third rows in more detail.
How to diagnose the HSTS error on your site
Test from outside your own network, using the exact host name visitors use. First see what certificate the server presents and whether it chains to a trusted root:
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>&1 \
| grep "Verify return code"
Read the output like this:
- notAfter in the past means the certificate has expired.
- subjectAltName without the host you tested means a name mismatch.
- Verify return code: 0 (ok) means the chain is good. Codes 18, 19, 20 or 21 point to a self-signed certificate or a missing intermediate.
Then find where the HSTS rule comes from, so you know which hosts it covers:
curl -sI https://example.com/ | grep -i strict-transport
curl -sI https://www.example.com/ | grep -i strict-transport
If the apex shows includeSubDomains, every subdomain needs a valid certificate. Also check the domain's status on hstspreload.org. In Chrome, chrome://net-internals/#hsts lets you query a domain and see whether your own browser holds a dynamic rule for it.
If the error only appears on some devices, particularly older phones or some Android apps, suspect the chain. Some clients fill in a missing intermediate certificate by themselves and others do not, which is why a broken chain can look fine on your desktop.
Fixing the certificate on common servers and platforms
Expired certificates
For Let's Encrypt with Certbot, run a renewal and reload the web server, then check the renewal timer so it does not happen again:
sudo certbot renew
sudo systemctl reload nginx
systemctl list-timers | grep certbot
On Plesk, open SSL/TLS Certificates for the domain and renew the Let's Encrypt certificate, making sure it covers both the domain and the www alias. On cPanel, run AutoSSL from SSL/TLS Status.
Missing host names
Reissue the certificate with every host name visitors use, for example:
sudo certbot --nginx -d example.com -d www.example.com -d shop.example.com
Missing intermediate
Point nginx at the full chain file, not the leaf certificate on its own:
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
Cloudflare
Cloudflare's free Universal SSL covers the apex and first-level subdomains such as shop.example.com, but not deeper names such as eu.shop.example.com. A proxied deeper name produces a certificate error that HSTS makes impossible to bypass. Use an advanced certificate, or set that record to DNS only and give the origin its own certificate.
Subdomains that cannot have a certificate yet
If an internal host genuinely cannot run HTTPS for now, remove includeSubDomains from the parent and send max-age=0 to clear stored rules, as explained in the guide to disabling HSTS. Then add the certificate and restore the header.
When the cause is the visitor, not the site
If your certificate checks out from outside and only some people report the error, look at their side. These cause the same HSTS screen on perfectly healthy sites, including Google, banks and social networks:
- Wrong date or time. A device clock set months out makes every certificate look expired or not yet valid. Setting the time automatically fixes it.
- Antivirus HTTPS scanning. Some security software intercepts HTTPS with its own certificate. If its root certificate is missing or damaged, every HSTS site fails.
- Public and hotel Wi-Fi. Captive portals intercept the first request to show a login page, which looks like an attack to the browser. Opening an
http://address that is not preloaded usually brings up the portal. - Workplace networks. Inspection proxies need their root certificate installed on each device.
- Old devices. Phones and computers that no longer receive updates may not trust newer root certificates.
The fix, step by step
Step 1
Read the error code
Open the site in Chrome or Firefox and note the code under the HSTS message, such as NET::ERR_CERT_DATE_INVALID or SEC_ERROR_UNKNOWN_ISSUER. Click it, or use View Certificate, to see the certificate the browser received: its host names, issuer and dates. Note the exact host name in the address bar. You are done when you know which host fails and whether the problem is expiry, a name mismatch or trust.
Step 2
Check the certificate from outside
Run openssl s_client with -servername set to the failing host, from a network other than your own, and print the subject, issuer, dates and subject alternative names. Check the verify return code: 0 means the chain is good. If it all looks right and only some people see the error, move to the visitor-side checks instead, because the fault may be on their device or network.
Step 3
Find which rule covers the host
Run curl -sI on the apex and the failing host and read the Strict-Transport-Security values. If the apex sends includeSubDomains, it is the parent's rule that makes the subdomain error unbypassable. Check hstspreload.org for preload status. Note the result, because it tells you whether a certificate fix alone is enough, or whether you also need to change the header for a while.
Step 4
Renew an expired certificate
If the dates are wrong, renew the certificate: run sudo certbot renew and reload nginx or Apache, renew Let's Encrypt in Plesk, or run AutoSSL in cPanel. Then check why automatic renewal failed, such as a blocked challenge path, a DNS change or a stopped timer, and fix that too. Rerun openssl s_client and confirm the new expiry date is now being served.
Step 5
Add missing host names
If the subject alternative names do not include the failing host, reissue the certificate with every name visitors use, for example the apex, www and each subdomain. In Plesk tick the www alias and any subdomains. On Cloudflare, check the host is covered by the edge certificate, remembering that Universal SSL does not cover deeper subdomains. Confirm the new certificate lists every name.
Step 6
Serve the full certificate chain
If the verify code reports an issuer problem, configure the server to send the intermediate certificate as well as your own. In nginx use fullchain.pem for ssl_certificate; in Apache 2.4.8 or later put the chain into the file named by SSLCertificateFile. Replace any self-signed or panel default certificate with a trusted one. Reload and check the verify code is now 0.
Step 7
Deal with subdomains that cannot use HTTPS
If a host covered by includeSubDomains genuinely cannot have a valid certificate yet, remove includeSubDomains from the apex header and send max-age=0 from the apex for a while to clear stored rules. This weakens protection, so treat it as temporary. Add a certificate to the host as soon as you can, then restore the full header and check the host opens cleanly.
Step 8
Test on several devices
Open the failing host in Chrome, Firefox and Safari, on desktop and on a phone using mobile data rather than your Wi-Fi. Clear any cached error by reloading. If you use a load balancer or several servers, test each one. You are finished when every browser opens the page with a padlock and no warning, and openssl s_client shows the correct dates, names and a verify code of 0.
Edge cases worth knowing
- Preloaded endings. Every site under some endings, including .app and .dev, is HSTS by default. A certificate problem on such a site always produces an unbypassable error.
- IPv6 and default sites. If the server has a separate IPv6 configuration without the right certificate, visitors on IPv6 get the default site's certificate and a name mismatch, while IPv4 visitors see no problem.
- Load balancers. One node with an old certificate causes intermittent errors. Test several times, or test each node directly.
- Clearing HSTS locally. Deleting the rule in your own browser lets you reach a broken site for testing, but changes nothing for visitors.
Keeping HSTS errors away
- Monitor certificate expiry for every host name, including subdomains, and alert at least 14 days before the end date.
- After every renewal, check the live certificate with
openssl s_client, not just the file on disk, because a server that was not reloaded keeps serving the old one. - Keep a list of every subdomain in DNS. Before adding
includeSubDomains, confirm each one has a valid certificate. - Use full chain files and test from a phone on mobile data as well as your desktop.
The SSL errors guide covers the wider set of certificate problems that sit underneath these warnings.
1. What does an HSTS error mean?
An HSTS error means the browser found a problem with the site's certificate and, because the site uses HTTP Strict Transport Security, it will not let you continue. HSTS is a rule the site set telling browsers to accept only secure connections. The real fault is shown in the error code, such as an expired certificate, a certificate for the wrong name or one the browser does not trust. The HSTS part simply explains why there is no option to proceed.
2. How do I fix an HSTS error in Chrome?
If it is your site, you fix an HSTS error in Chrome by fixing the certificate problem underneath it. Read the error code on the warning page: an expired date means renewing the certificate, a common name error means adding the missing host name, and an authority error means installing the intermediate chain or replacing a self-signed certificate. If it is someone else's site, check your device's date and time, any antivirus HTTPS scanning and whether you are on public or workplace Wi-Fi.
3. Can I bypass an HSTS error?
No, browsers deliberately offer no supported way to bypass an HSTS error, because preventing click-through on certificate warnings is the whole point of HSTS. You can delete a stored HSTS rule in your own browser for testing, but it does not work for preloaded sites and it removes protection you may need. For a site you own, the only proper fix is a valid certificate. For a site you do not own, check your clock, network and security software first.
4. Why do I get an HSTS error on Chrome for Android?
On Chrome for Android, the HSTS error usually comes from the same certificate problems as on desktop, plus a few that are more common on phones. A device clock set wrongly, a public Wi-Fi login page and older Android versions that no longer trust newer root certificates all cause it. If your own site works on desktop but fails on some phones, check that the server sends the full certificate chain, since some clients cannot fill in a missing intermediate themselves.
5. What is the HSTS error in Firefox?
In Firefox, the HSTS error appears as Did Not Connect: Potential Security Issue, with a note that the site uses HTTP Strict Transport Security and that you cannot add an exception. Firefox shows an error code such as SEC_ERROR_UNKNOWN_ISSUER, SEC_ERROR_EXPIRED_CERTIFICATE or SSL_ERROR_BAD_CERT_DOMAIN, which tells you whether the certificate is untrusted, expired or issued for another name. The fix on the site is the same as for Chrome: correct the certificate, not the HSTS header.
6. Why does Google show an HSTS error?
When Google or another large site shows an HSTS error, the cause is almost always on your device or network, not on Google's side. Google's domains are on the browser preload list, so any certificate problem blocks you completely. Common culprits are a wrong system date or time, antivirus software that scans HTTPS, a hotel or café Wi-Fi login page intercepting the connection, and workplace inspection proxies. Fix the clock first, then try another network to narrow it down.
7. Why does my site say HSTS and will not load on a subdomain?
Your subdomain fails because the main domain sends HSTS with includeSubDomains, so browsers that visited the main site now apply HSTS to every subdomain too. If the subdomain has a self-signed, expired or mismatched certificate, visitors used to be able to click through, but HSTS removes that option. The fix is a valid certificate for the subdomain. If that is not possible yet, remove includeSubDomains and send max-age=0 from the main domain temporarily.
Run the security audit on aiwebpageseo.com to see your certificate status, expiry date and Strict-Transport-Security header together, so you can catch problems before visitors see an HSTS error.
Open Security Audit Fixes →