HSTS Explained: Strict-Transport-Security and the Preload List

What HTTP Strict Transport Security does, the right max-age and directives to use, how preloading works, and mistakes to avoid.

Yrzo AI28 November 2026 2 min read

The gap HSTS closes

Even if your site redirects HTTP to HTTPS, the very first request a visitor makes may go out over plain HTTP — when they type your domain without https:// or follow an old link. On an untrusted network, that first request can be intercepted and the visitor kept on a fake HTTP version of your site. This is a classic man-in-the-middle attack.

HTTP Strict Transport Security (HSTS) tells browsers: "Only ever connect to this site over HTTPS."

How it works

Your server sends a response header such as:

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

After seeing it once over HTTPS, the browser automatically upgrades every future request to HTTPS for the max-age period, and refuses to let users click through certificate errors.

The directives

  • max-age — how long, in seconds, browsers remember the rule. One year (31536000) is the common recommendation. Short values like 300 give little protection.
  • includeSubDomains — applies the rule to every subdomain. Only add it once every subdomain supports HTTPS.
  • preload — signals that you want to be included in browsers' built-in HSTS list.

Is your site exposed to this?

Run a free, non-intrusive check of what attackers can see from outside. No account needed.

Preloading

Browsers ship with a list of domains that are HTTPS-only from the very first visit. You can submit your domain at hstspreload.org if your header has max-age of at least one year, includeSubDomains and preload.

Preloading is powerful but hard to undo: removal can take months to reach all users. Only preload when you are confident every subdomain, now and in future, will use HTTPS.

Rolling it out safely

  1. Make sure HTTPS works everywhere, with a valid certificate — see SSL certificate security.
  2. Start with a short max-age (for example one day) without includeSubDomains.
  3. Increase to one year once nothing breaks.
  4. Add includeSubDomains after checking every subdomain.
  5. Consider preload last.

Common mistakes

  • sending HSTS over HTTP (browsers ignore it there)
  • a tiny max-age that expires before users return
  • includeSubDomains with an old HTTP-only subdomain still in use

Check and fix

HSTS is one of several headers every site should send — see HTTP security headers explained and how to fix security headers. Yrzo AI checks your HSTS value and tells you exactly what to change — run a free scan.

Related reading: How to Check Your Website's SSL/TLS Configuration · Cookie Security Flags Explained: Secure, HttpOnly and SameSite · Website Security Checklist Before Launch

HSTS explainedStrict-Transport-Security headerHSTS preloadHSTS max-age
Share

Check your own website in 60 seconds

Free check, no account needed. Want the full picture? Full reports start at £149, with up to 110 checks with a 14-day money-back guarantee.

Keep reading