/ โ† Security Audit Fixes / Disable HSTS
In this guide
  1. What turning off HSTS actually involves
  2. Find where your HSTS header comes from
  3. How to disable HSTS with max-age=0
  4. How to remove a domain from the HSTS preload list
  5. How to clear HSTS from your own browser for testing
  6. The risks of turning HSTS off
  7. The fix, step by step
  8. Edge cases worth knowing
  9. Bringing HSTS back safely
  10. Questions and answers

What turning off HSTS actually involves

HTTP Strict Transport Security is a response header that tells browsers to use HTTPS for your domain, and only HTTPS, for a set length of time:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Once a browser has seen that header over a valid HTTPS connection, it stores the rule. For the next max-age seconds, here one year, it rewrites every http:// request for the domain to https:// before sending anything, and it refuses to let visitors click past certificate errors.

That stored rule is why HSTS is hard to switch off. Deleting the header from your server does nothing for browsers that already have the rule; they simply keep following it until it expires. To disable HSTS properly you have to deal with three separate places it can live:

Where HSTS livesHow it gets thereHow it is removed
Your server or CDNA header you or your host configuredChange the header to max-age=0, later remove it
Each visitor's browserStored after a visit over HTTPSExpires, or is cleared by a max-age=0 header on the next HTTPS visit
The browser preload listSubmitted at hstspreload.orgA removal request, then a wait for new browser releases

Before going further, be clear why you want it off. If a subdomain or test site shows an HSTS error, the better fix is usually a valid certificate on that host, which the HSTS error guide covers. Turning HSTS off is the right call mainly when includeSubDomains or preload was added too early and is catching hosts that genuinely cannot run HTTPS yet.

Find where your HSTS header comes from

HSTS can be added by the web server, the control panel, the CDN, the application or a CMS plugin, and more than one of them can be doing it. Check what is actually sent:

curl -sI https://example.com/ | grep -i strict-transport
curl -sI https://www.example.com/ | grep -i strict-transport
curl -sI https://shop.example.com/ | grep -i strict-transport

If you use a CDN, also request the origin server directly so you can tell whether the CDN or the server adds the header. Then search the server configuration:

sudo grep -ril "strict-transport-security" /etc/nginx /etc/apache2 /etc/httpd /var/www/vhosts/*/conf 2>/dev/null
grep -i "strict-transport" /var/www/example.com/.htaccess

Common places it hides:

Check whether the domain is on the preload list as well, using the status check at hstspreload.org. If it is, header changes alone will not turn HSTS off in Chrome, Firefox, Safari or Edge.

How to disable HSTS with max-age=0

The correct way to turn HSTS off is to keep sending the header for a while, but with a lifetime of zero. When a browser receives max-age=0 over HTTPS, it deletes its stored rule for that host straight away.

Strict-Transport-Security: max-age=0

Note what is missing: no includeSubDomains and no preload. Leave HTTPS itself running with a valid certificate, because browsers only accept the header over a trusted HTTPS connection. A header sent over plain HTTP is ignored.

nginx

add_header Strict-Transport-Security "max-age=0" always;

Apache or .htaccess

Header always set Strict-Transport-Security "max-age=0"

Cloudflare

In the HSTS settings, set Max Age to 0 and switch off include subdomains and preload, rather than disabling the feature outright. Disabling stops the header, which leaves stored rules in place until they expire.

How long to keep sending it

Only browsers that come back to the site receive the zero value. Keep sending max-age=0 for at least as long as your old max-age, or as long as you reasonably can. A visitor who last came eight months ago with a one-year rule still has four months to run, and only a visit after the change clears it early.

โš ๏ธ If the problem is a subdomain caught by includeSubDomains, send the zero header from the parent domain, usually the apex such as example.com. The rule was stored against that host, and only a response from it can clear it.

How to remove a domain from the HSTS preload list

A preloaded domain is built into the browser itself. No header can override it, because the browser applies the rule before it has ever contacted your server. Removal is a slow, deliberate process:

  1. Stop sending the preload token. Change your header to drop it, or go straight to max-age=0.
  2. Submit the domain on the removal form at hstspreload.org. The form checks that the preload token is no longer present.
  3. Wait. The removal is made in Chromium's list, which is shipped with a later Chrome release, and other browsers that use the same list pick it up on their own schedules.
  4. Wait again for visitors to update their browsers. Anyone on an old version still has the rule built in.

In practice, expect removal to take months, not days. That is why preload is meant for domains that are certain to stay on HTTPS for good.

๐Ÿ’ก Some top-level domains, including .app and .dev, are preloaded as a whole. Every site under them is HTTPS-only in modern browsers and HSTS cannot be turned off at all.

How to clear HSTS from your own browser for testing

While you test, your own browser will keep enforcing the old rule. You can clear dynamically stored rules on your machine, but not preloaded ones.

BrowserHow to clear a stored HSTS rule
Chrome, Edge, BraveOpen chrome://net-internals/#hsts (or edge://net-internals/#hsts), type the domain under Delete domain security policies and press Delete. Use Query HSTS/PKP domain to confirm.
FirefoxOpen History, then Manage History, right-click the site and choose Forget About This Site. This also clears its cookies and cache.
SafariClearing history and website data for the site generally removes it. Quit and reopen Safari before testing.

This only affects your own browser. Clearing it does not help your visitors, whose rules are cleared only by receiving max-age=0 or by expiring. Visiting the site over HTTPS again after clearing will store the rule again if the server still sends a positive max-age.

The risks of turning HSTS off

HSTS exists because the first plain HTTP request is easy to intercept on public Wi-Fi. Without it, an attacker on the same network can keep a visitor on an http:// version of your site and read or alter what they send, even if you redirect HTTP to HTTPS. Turning HSTS off brings that risk back.

The usual safer path is to turn HSTS off only temporarily, fix whatever made it a problem, and then bring it back gradually, starting with a short max-age such as 300 seconds and raising it once every host works.

The fix, step by step

Step 1

Check what is sent and where

Run curl -sI on the apex, the www host and any affected subdomain and note the Strict-Transport-Security value. If you use a CDN, test the origin too. Search the server configuration, control panel settings, CDN dashboard and plugins for the header. Check the domain at hstspreload.org. You are done when you know every layer that sends the header and whether the domain is preloaded.

Step 2

Keep HTTPS working

Make sure every host that sends the header has a valid, trusted certificate before you change anything. Browsers only read the header over a trusted connection, so a broken certificate means visitors never receive the instruction to clear the rule. Test each host in a browser and with curl -sI, which fails with a certificate error if the chain or hostname is wrong. Fix any certificate problems before continuing.

Step 3

Change the header to max-age=0

Replace the header value with max-age=0, removing includeSubDomains and preload. In nginx use add_header Strict-Transport-Security "max-age=0" always;, in Apache Header always set, and in Cloudflare set Max Age to 0. Reload the server and purge the CDN cache. Run curl on every host again and confirm the zero value appears once on each, including on redirect responses.

Step 4

Remove other sources of the header

Turn off any duplicate HSTS setting in plugins, the control panel, the application or the CDN, or change each one to the zero value. Spring Security, for example, adds its own header over HTTPS unless you configure or disable it. Run curl again on the CDN address and the origin. Every response should now carry exactly one header, and it should say max-age=0.

Step 5

Request preload removal if needed

If the domain is on the preload list, confirm the preload token is no longer in your header, then submit the domain on the removal form at hstspreload.org. Note the date. Keep the zero header in place throughout, because removal from browsers takes months. Check the status page from time to time; it shows whether the removal is pending or has been made in the list.

Step 6

Clear the rule in your own browser

To test without waiting, open chrome://net-internals/#hsts in Chrome or Edge, delete the domain's security policy, then query it to confirm nothing is stored. In Firefox use Forget About This Site. Then visit an http:// address on the site and check in DevTools that no internal redirect to HTTPS happens. A preloaded domain will still be forced to HTTPS until the removal ships.

Step 7

Keep sending max-age=0 long enough

Leave the zero header in place for at least as long as the old max-age value, because only returning visitors receive it. Put a reminder in your calendar for the date the old rule would have expired for everyone. Until then, do not remove the header entirely. Recheck with curl after server updates, migrations or control panel upgrades, which can silently restore an old configuration.

Step 8

Fix the cause, then re-enable gradually

Use the break to fix whatever made HSTS a problem, usually a subdomain without a valid certificate. Then bring HSTS back with a short max-age such as 300, and increase it in stages to one year, checking every host at each stage. Add includeSubDomains only when every subdomain works over HTTPS, and preload only when that is permanent. Confirm each stage with curl before moving to the next.

Edge cases worth knowing

Bringing HSTS back safely

Once the hosts that caused trouble have working certificates, re-enable HSTS in stages so a mistake costs minutes rather than a year.

Strict-Transport-Security: max-age=300
Strict-Transport-Security: max-age=86400; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains

Spend a few days at each stage, checking every subdomain with curl and in a browser. Only add preload when you are sure that every current and future subdomain will run HTTPS. The guide to adding HSTS walks through the full setup on each server.

Questions and answers

1. How do I disable HSTS?

To disable HSTS, change your Strict-Transport-Security header to max-age=0 and keep sending it over HTTPS for at least as long as your old max-age. Browsers that receive the zero value delete their stored rule straight away. Simply removing the header does not work, because browsers keep following the rule they already have until it expires. If the domain is on the preload list, you also need to request removal at hstspreload.org and wait for new browser versions to ship without it.

2. How do I turn off HSTS in Chrome?

To turn off HSTS for a domain in your own copy of Chrome, open chrome://net-internals/#hsts, enter the domain under Delete domain security policies and press Delete. This clears rules Chrome learned from the site's header, but it cannot remove domains on the built-in preload list, and the rule returns on your next HTTPS visit if the site still sends it. It also only affects your browser. To turn HSTS off for visitors, the site must send max-age=0.

3. Does removing the HSTS header disable HSTS?

No, removing the HSTS header does not disable it for visitors who already have the rule stored. Their browsers keep enforcing HTTPS until the max-age they last received runs out, which is often a year or two. Only new visitors are unaffected. To clear existing rules, you must keep sending the header with max-age=0 over a valid HTTPS connection, so returning visitors' browsers are told to forget it. Remove the header completely only after the old max-age would have expired.

4. How long does HSTS preload removal take?

HSTS preload removal usually takes months. After you stop sending the preload token and submit the removal form, the domain is taken out of Chromium's list, which then has to ship in a new Chrome release. Firefox, Safari and Edge take the change on their own schedules, and visitors must then update their browsers. Until all of that happens, preloaded browsers force HTTPS regardless of your header, so keep HTTPS working throughout and plan for a long wait.

5. Is it safe to turn off HSTS?

Turning off HSTS is safe for your site to function but makes visitors easier to attack. Without it, the first request to your site can go over plain HTTP, and someone on the same network can intercept it before your redirect to HTTPS happens. Security scans will also flag the missing header. If you must turn it off, treat it as temporary, fix the hosts that caused the problem and then re-enable HSTS, starting with a short max-age and increasing it gradually.

6. Can I disable HSTS for just one subdomain?

You can only do this if the rule covering the subdomain is not coming from the parent with includeSubDomains. If the apex sends includeSubDomains, every subdomain is covered and the subdomain itself cannot opt out. You would have to remove includeSubDomains from the parent's header and send max-age=0 from the parent to clear the stored rule. The better fix is usually to give the subdomain a valid certificate so HTTPS works there too, and keep HSTS in place.

7. Why does my browser still force HTTPS after I disabled HSTS?

Your browser still forces HTTPS because it has the rule stored, the domain is preloaded, or the site still sends a positive max-age from another layer. Check with curl that every response, including redirects, sends max-age=0. Clear the stored rule in chrome://net-internals or with Forget About This Site in Firefox. If the domain is on a preload list or under a preloaded ending such as .dev, nothing you clear locally will stop it until browsers ship the change.

Check your HSTS header on every host

Run the security audit on aiwebpageseo.com to see the exact Strict-Transport-Security value each page sends, including max-age, includeSubDomains and preload, alongside your other security headers.

Open Security Audit Fixes โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: All Security Audit Fixes  ·  Fix an HSTS error in Chrome or Firefox  ·  Add a missing HSTS header  ·  Fix HTTP to HTTPS redirects  ·  Security headers on Cloudflare  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.