← Back to Learning Hub

DNS Records • Intermediate • 6 min read

HSTS and the Preload List: Force HTTPS the Right Way

How the HSTS header forces HTTPS, what max-age and includeSubDomains commit you to, and the one-way risk of adding your domain to the browser preload list.

HTTP Strict Transport Security, or HSTS, is a response header that tells a browser to only ever talk to your site over HTTPS, even if a user types the bare domain or clicks an old http link. It closes a real gap: the first plaintext request before a redirect to HTTPS, which an attacker on the network can hijack. This guide explains how the header works, what the max-age and includeSubDomains directives commit you to, and the one-way risk of submitting your domain to the browser preload list, so you can force HTTPS without accidentally taking your own subdomains offline.

What problem HSTS solves

Most sites redirect http to https, but that redirect is itself sent over plain http on the very first visit. An attacker positioned on the network can intercept that first unencrypted request and keep the user on a spoofed plaintext connection, a technique known as SSL stripping. HSTS, defined in RFC 6797, removes the opening by instructing the browser to upgrade every request to the site to HTTPS before anything leaves the device. Once a browser has seen a valid HSTS header, it will not even attempt http for that host until the policy expires. The header only takes effect when delivered over a valid HTTPS connection, which is deliberate: an attacker cannot inject or weaken the policy over plaintext.

Reading the header and its directives

A typical header looks like Strict-Transport-Security: max-age=31536000; includeSubDomains; preload. Each directive carries a specific commitment, and getting them wrong is how sites lock themselves out.

DirectiveWhat it doesWhat to watch
max-ageSeconds the browser enforces HTTPS, refreshed on each visitApplies to repeat visitors until it expires; start low, then raise
includeSubDomainsExtends the policy to every subdomainAny subdomain without working HTTPS becomes unreachable
preloadSignals intent to be hardcoded into browsersHas real effect only after you submit to the preload list

The max-age value is a sliding window: every time a visitor loads the site, the clock resets to the full duration. That means a long max-age sticks with returning users for a long time regardless of what you do server-side later, which is the heart of the risk discussed below.

max-age: start small, then commit

Because the policy lives in each visitor's browser for the full max-age, you cannot undo a mistake by simply changing the header; returning browsers keep enforcing the old value until it expires. The safe path is to ramp. Begin with a short max-age such as 300 seconds while you confirm every page and asset loads cleanly over HTTPS. Raise it to a few days, then to a few weeks, watching for breakage at each step. Only once you are confident should you move to the long value, commonly one year (31536000 seconds), that preload eligibility requires. To turn HSTS off deliberately, serve max-age=0 and leave it in place long enough for cached policies to expire naturally.

includeSubDomains: the directive that bites

Adding includeSubDomains applies the HTTPS-only rule to every host under your domain, including ones you may have forgotten. An internal tool on a subdomain that still serves plain http, a legacy box without a certificate, or a third-party service pointed at a subdomain will all become unreachable in browsers that have seen the policy. Before you add includeSubDomains, inventory every subdomain and confirm each one serves valid HTTPS. Checking that each host presents a trusted, in-date certificate is worth doing first, as described in our guide on how to check an SSL certificate issuer, chain, expiry, and SAN.

The preload list and its one-way door

The preload list is a set of domains that browser vendors ship hardcoded as HTTPS-only, so the policy applies on the very first visit with no header needed at all. You submit your domain at the community-run preload site, hstspreload.org, and once it is accepted and baked into a browser release, every user of that browser enforces HTTPS for your domain from the start. That is powerful, and it is close to permanent. Removal is possible but slow: you request removal, wait for it to propagate into new browser releases, and even then older installed browsers keep the hardcoded entry for a long time. Treat preload submission as a commitment that every host under your domain will serve HTTPS indefinitely. The eligibility rules, as of November 2026, require serving a valid certificate, redirecting http to https on the same host, and sending a header with max-age of at least one year plus includeSubDomains and the preload token.

A safe rollout checklist

  1. Serve valid HTTPS on the apex and every subdomain, and redirect all http traffic to https.
  2. Add the header with a short max-age, without includeSubDomains, and confirm nothing breaks.
  3. Inventory every subdomain and verify each one has working, trusted HTTPS.
  4. Add includeSubDomains once that inventory is clean, and watch for any newly unreachable host.
  5. Raise max-age in stages up to one year, checking at each step.
  6. Only then, if you truly want first-visit protection, add the preload token and submit at hstspreload.org, understanding it is hard to reverse.

You can confirm the certificate behind each host before you commit by running it through the Valla DNS SSL checker, which reports the live chain and expiry your server presents.

How HSTS fits with HTTPS records

HSTS is enforced after a browser has reached your site at least once or found you on the preload list. A newer, complementary mechanism is the HTTPS DNS record, which can advertise HTTPS support and connection hints before the first connection even starts. The two work together: the HTTPS record helps steer the very first connection, while HSTS keeps every later one on HTTPS. Our guide on HTTPS and SVCB records covers that DNS-level piece.

Frequently asked questions

Can I turn HSTS off once I have enabled it?

Not instantly. Returning browsers enforce the policy until the max-age you last sent expires. To disable it, serve max-age=0 and keep that in place until cached policies lapse. This is why you ramp max-age up slowly rather than jumping straight to a year.

What does includeSubDomains actually break?

It forces HTTPS on every subdomain, so any subdomain still serving plain http, lacking a certificate, or running a legacy service becomes unreachable in affected browsers. Inventory and fix every subdomain's HTTPS before adding the directive.

Is the preload list reversible?

Technically yes, practically slow. You can request removal, but it takes many browser release cycles to propagate, and older installed browsers keep the entry longer still. Treat preload as a long-term, near-permanent commitment to HTTPS across your whole domain.

Do I need preload if I already send the HSTS header?

No. The header alone protects every visit after the first. Preload only adds protection for the very first visit, before any header has been seen, by hardcoding the policy into the browser. It is optional and carries the most risk.

Does HSTS replace redirecting http to https?

No, it complements it. You still need the server-side redirect so first-time and non-HSTS clients reach HTTPS, and preload eligibility explicitly requires that redirect. HSTS then ensures returning browsers skip the plaintext step entirely.

HSTS is one of the highest-value security headers you can set, but its stickiness means a careless rollout can lock out your own subdomains. Ramp max-age, verify every host's certificate first, and treat preload as the final, considered step. Check your live certificates anytime on the SSL checker.

Troubleshooting box

If results look inconsistent, compare authoritative nameservers first, then recursive resolvers by region. Capture snapshots every 10 minutes for deterministic incident timelines.

Try VallaDNS free →

Intermediate • 6 min

How to Find a DNS Record's TTL (Current Value)

Find the TTL currently set on a DNS record: read the TTL column in dig and nslookup, tell the authoritative TTL from a resolver's countdown, and confirm a change.

Intermediate • 7 min

How to Check If Nameservers Have Propagated

Nameserver changes live at the parent TLD and follow the registry NS TTL, not your zone. Check the parent delegation and confirm the new NS set worldwide.