HSTS Preloading: A Practical Guide

How to configure Strict-Transport-Security correctly and get your domain onto the browser preload list.

What HSTS does

When a user visits http://example.com for the first time, the server redirects them to https://example.com. That redirect happens over plain HTTP — before any TLS is established. An attacker on the same network (coffee shop Wi-Fi, a compromised router) can intercept that initial HTTP request and respond with their own content, or silently proxy the HTTPS session by stripping TLS: the SSL stripping attack.

HTTP Strict Transport Security (HSTS, RFC 6797) addresses this. Once a browser has visited a site over HTTPS and received the Strict-Transport-Security header, it remembers for the duration of max-age that this domain must only be contacted over HTTPS. Future visits bypass the initial HTTP step entirely — the browser upgrades to HTTPS internally before sending any request.

The limitation: HSTS only takes effect after the first successful HTTPS visit. A first-time visitor, or someone who has never visited before, still has no protection. This is the "first-visit problem," and it is why the preload list exists.

The header explained

The header is set by your HTTPS server in HTTP responses:

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

Each directive:

The preload list

The HSTS preload list (maintained at hstspreload.org and baked into Chrome, Firefox, Safari, and Edge) contains domains that browsers will always connect to over HTTPS — even on a completely fresh install with no browsing history. These domains have HTTPS enforced before the first byte is sent, eliminating the first-visit problem.

Eligibility requirements:

The commitment this implies: once you are on the preload list, all subdomains must serve valid HTTPS for as long as browsers have your entry. Removing a subdomain from DNS, or letting a certificate expire, will make that subdomain unreachable in browsers. Getting removed from the preload list takes months and you remain in older browser versions for years. Do not submit until every subdomain has working HTTPS.

Deployment checklist

Deploy HSTS safely in stages:

  1. Inventory all subdomains. Check DNS for every active subdomain. Each one needs a valid, auto-renewing certificate before you add includeSubDomains.
  2. Deploy HTTPS everywhere. Ensure every subdomain redirects HTTP to HTTPS and has a valid certificate. Test certificate renewal.
  3. Start with a short max-age. Set max-age=300 (5 minutes) on your production HTTPS responses. Monitor for breakage over several days. This gives you a fast exit if something is wrong — the browser forgets quickly.
  4. Increase gradually. 300 → 86400 → 604800 → 2592000 → 63072000. Each step, wait for the previous max-age to expire in testing environments before proceeding.
  5. Add includeSubDomains and preload once you are confident in the long max-age with the base domain only.
  6. Submit to hstspreload.org.

Common mistakes

How to verify

Check the HSTS header by fetching your domain's HTTPS response and inspecting the headers:

The TLS inspector checks the HSTS header, redirect chain, and certificate together, so you can see at a glance whether HTTPS is correctly configured end-to-end.

HSTS and HTTPS redirects

HSTS depends on HTTPS redirects being in place, but they are different mechanisms. The redirect (HTTP 301 from port 80) handles clients that have not yet learned the policy. HSTS handles clients that have learned it — they skip port 80 entirely. Both must work correctly. A broken redirect does not affect browsers that already have the HSTS policy cached, but it affects all first-time visitors and any client that does not validate HSTS. Check that your HTTP-to-HTTPS redirect returns a permanent 301 (not 302) and does not introduce redirect loops.

Check your domain's HSTS and TLS configuration

Checks HSTS header, redirect chain, and TLS configuration for your domain.

Check your site's HTTP headers with spectra