Fix guide · tested 18 October 2026 · updated 15 November 2026

How to fix "HSTS missing from HTTPS server"

Security scanners report "HSTS missing from HTTPS server" when your HTTPS responses don't include a Strict-Transport-Security header.

"HSTS missing from HTTPS server" means your site's HTTPS responses don't send the Strict-Transport-Security header, so browsers may still try plain HTTP first, where a network attacker can intercept the request. Fix it by sending Strict-Transport-Security: max-age=31536000; includeSubDomains on every HTTPS response, after confirming that every subdomain works over HTTPS. Start with a short max-age, raise it in stages, and only add preload when you're sure. Check it with one read-only request: curl -sI https://yoursite.com | grep -i strict-transport.

How we tested this: This site sends the header shown here from Cloudflare Workers static assets via a _headers file, and from its edge worker for redirects. We checked it with curl on 18 October 2026. On 15 November 2026 we re-ran the curl check: the homepage, this guide, a 404 page and the www-to-bare-domain 301 all returned the header. The Nginx, Apache and roll-back notes come from their official docs (read 15 November 2026) and were not tested on this site.

Why it matters

MDN describes HSTS as telling browsers that a host should only be reached over HTTPS, and that future HTTP attempts should be upgraded automatically. Without it, someone who types your domain or follows an old http:// link makes a first request over plain HTTP. On shared Wi-Fi, that request can be intercepted before your redirect to HTTPS arrives.

Two details matter. Browsers ignore the header if it's sent over plain HTTP, so it only works on HTTPS responses. And the very first visit is still unprotected until the browser has seen the header once, which is what the preload list addresses.

MDN also notes a side effect: once a browser has your HSTS policy, it won't let visitors click through certificate errors, such as an expired or invalid certificate, on your domain. That blocks a fake HTTPS page, but it also means an expired certificate takes your site offline for those visitors until you renew it.

Check it first (read-only)

This sends one ordinary HEAD request and prints the header if it exists. It changes nothing.

curl -sI https://yoursite.com/ | grep -i strict-transport-security

No output means the header is missing. Free scanners such as Mozilla's HTTP Observatory and Security Headers report the same thing (see free website security scanners).

The fix, step by step

  1. Make sure everything works over HTTPS. Check your main domain and every subdomain, including ones only used internally. With includeSubDomains, browsers will refuse plain HTTP on all of them.
  2. Add the header with a short max-age. The HSTS preload site recommends ramping up in stages: 5 minutes (300), then 1 week (604800), then 1 month (2592000), checking for broken pages at each stage. On Cloudflare Workers static assets or Cloudflare Pages, put it in a _headers file in your output folder. Cloudflare also has an HSTS switch on every plan, including Free (SSL/TLS, then Edge Certificates), but per Cloudflare's docs (re-read 15 November 2026) its Max Age options run from 1 to 12 months, so use the _headers file or a response header transform rule for the short first stages. To have it set up with your other headers, WAF and cache rules, see Cloudflare hardening.
    /*
      Strict-Transport-Security: max-age=300; includeSubDomains
  3. Raise max-age to one year. When nothing breaks, set the long value. This is what this site sends today.
    Strict-Transport-Security: max-age=31536000; includeSubDomains
  4. Cover redirects too. If your redirects (for example www to the bare domain) come from a worker or server, send the header on those HTTPS responses as well. This site's edge worker adds it to its 301 responses. The plain-HTTP to HTTPS redirect is different: MDN says it must not carry the header, because browsers only accept it over HTTPS. The HTTPS page the redirect lands on sends it.
  5. Verify. Run the curl check again on a few pages and on a redirect. Each HTTPS response should include the header.

Should you add preload?

MDN notes that preload requires a max-age of at least 31536000 (one year) and includeSubDomains. Being on the preload list protects even first visits, because browsers ship with your domain built in. It's also hard to undo: removal takes a long time to reach every browser. Only submit at hstspreload.org once you're sure every subdomain will stay on HTTPS.

Other hosts

The header is the same everywhere. Only where you set it changes: your host's headers configuration (for example a headers file or project config on static hosts), your web server's config, or your CDN's response header rules. Set it on HTTPS responses only, then run the curl check. If your site is behind a CDN, set it in one place to avoid sending two different values.

Nginx. Put it in the server block that listens on 443. The NGINX blog explains that always also adds it to error responses, and that a location block with its own add_header lines doesn't inherit the server-level ones, so repeat the header there.

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

Apache. With mod_headers enabled, add it to the HTTPS virtual host. The mod_headers docs explain that the always condition also covers error responses and locally generated redirects, which the default condition misses.

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

Common mistakes

FAQ

What does "HSTS missing from HTTPS server" mean?

Your HTTPS responses don't include the Strict-Transport-Security header, so browsers aren't told to always use HTTPS for your site.

What HSTS value should I use?

max-age=31536000; includeSubDomains is a common long-term value. Start lower, for example max-age=300, and raise it in stages once you've confirmed every subdomain works over HTTPS.

Can HSTS break my site?

Yes, if a subdomain doesn't support HTTPS and you use includeSubDomains. Browsers will refuse to load it until max-age expires. Ramp up gradually.

Does HSTS work over HTTP?

No. Browsers ignore the header when it's sent over plain HTTP. It must be on HTTPS responses.

How do I check HSTS without changing anything?

Run curl -sI https://yoursite.com/ | grep -i strict-transport-security, or use a free header scanner such as Mozilla's HTTP Observatory.

How do I turn HSTS off or roll it back?

Send Strict-Transport-Security: max-age=0 over HTTPS. MDN (read 15 November 2026) says this only takes effect when a browser makes a secure request and sees the new header, and that simply removing the header leaves the old policy in place until it expires. On Cloudflare's HSTS switch, set Max Age to 0 (Disable). Keep HTTPS working the whole time: Cloudflare warns that removing HTTPS before the old max-age runs out makes the site unreachable for those visitors.

Want someone to check it for you?

We check this as part of the $49 AI Site Audit. See how we test and what we don't check.

How this guide was made: researched and drafted with AI assistance, then every step was run and checked as described above on 18 October 2026. Editorial responsibility: ChikuOS. Found a problem? Email hello@chikuos.com.

Chat