Loading...

Skip to content
MemonaIQ
ToolsLearnCompany
Sign in
ToolsLearnCompanyBrowse all tools
Knowledge Center
In this topic
TLS & Web Security
How HTTPS works: TLS handshake, keys and encryptionSSL certificates: validation, chains and common errorsHow website trust scores work and what they missSame-origin policy and CORS: how cross-origin reads workXSS, CSRF and SSRF: how they work and how to prevent themZero trust security: principles and where to startHTTP security headers: which to send and whyContent Security Policy (CSP): directives and rolloutWhat is HSTS? Strict-Transport-Security and preloadCookie security: Secure, HttpOnly and SameSite explainedMCP security: tools, prompt injection and least privilegeMCP authorization and why token passthrough is forbiddenMCP tool annotations: what the hints mean and their limits
A-Z glossary
HomeKnowledgeTLS & Web Security
TLS & Web Security•3 min read•beginner

What is HSTS? Strict-Transport-Security and preload

How the Strict-Transport-Security header forces HTTPS, what it prevents, the first-visit gap, preload list requirements and the risk of preloading too early.

What HSTS does

HTTP Strict Transport Security (HSTS) is a response header that tells browsers to reach your domain only over HTTPS for a set period. Once a browser has seen it, it rewrites any http:// link or typed address to https:// before sending anything. It also stops users from clicking through certificate errors on that host.

Browsers honor the header only when it arrives over a valid HTTPS connection. Sent over plain HTTP it is ignored, because an attacker on the path could have added or removed it.

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

The three directives

The header has one required directive and two optional ones.

  • max-age: how long, in seconds, the browser remembers the policy. 31536000 is one year. Every response with the header restarts the timer, and max-age=0 tells the browser to forget the policy.
  • includeSubDomains: extends the policy to every subdomain of the host that sent it, such as www, api and any internal names.
  • preload: signals consent to inclusion in the browser preload list. On its own it changes nothing until the domain is submitted and accepted.

What HSTS prevents

Without HSTS, a visitor who types example.com starts with a plain HTTP request and relies on your redirect to reach HTTPS. An attacker on the same network can intercept that request and keep the visitor on HTTP while talking to your real site over HTTPS. This protocol downgrade is known as SSL stripping.

HSTS removes the plaintext step for domains the browser remembers. It also keeps cookies off plain HTTP. Every request to the host is upgraded before it leaves the browser, so even a cookie without the Secure flag isn't sent in clear text there. Set Secure on cookies anyway.

The first-visit gap

HSTS is learned from a response. The first request a browser ever makes to your site, or the first after the policy expires, can still go over HTTP. A visitor on a hostile network at that moment is exposed.

There is a quieter gap too. An includeSubDomains policy on example.com takes effect only after the browser visits example.com itself. People who only ever open www.example.com may never receive it.

Preloading closes both gaps by shipping your domain inside the browser.

Preload list requirements

Chromium maintains the HSTS preload list through hstspreload.org, and most major browsers base their own lists on it. To be accepted, a domain must:

  • Serve a valid certificate.
  • Redirect HTTP to HTTPS on the same host, if it listens on port 80.
  • Serve every subdomain over HTTPS, including www if a DNS record for it exists.
  • Send the header on the base domain with a max-age of at least 31536000 seconds (one year), includeSubDomains and preload.
  • Keep sending the header on any further redirect served over HTTPS.

Why preloading too early is risky

A preload entry covers every subdomain, including internal tools, staging hosts and old devices that only speak HTTP. Once you are listed, browsers refuse to reach any of them over HTTP, and removal takes months to reach users through browser updates.

Raise the policy in stages. Start with a short max-age, such as 300 seconds, without includeSubDomains. Add includeSubDomains once every subdomain has a valid certificate and works over HTTPS, then raise max-age step by step to a year and submit for preload last.

Previous guide
Content Security Policy (CSP): directives and rollout
Next guide
Cookie security: Secure, HttpOnly and SameSite explained
MemonaIQ tools

Try it on your own input

Check what this guide describes against your own URL, domain, code or file.

Web Security Configuration Workbench

Sign in to check a site's Strict-Transport-Security header and, when preload is set, whether it meets the preload requirements.

Open tool
Website Launch Readiness Checker

Sign in to confirm your homepage redirects HTTP to HTTPS and sends HSTS before you go live.

Open tool

References

  • RFC 6797: HTTP Strict Transport Security (HSTS)
  • HSTS Preload List Submission
  • HTTP Strict Transport Security Cheat Sheet (OWASP)

On this page

What HSTS doesThe three directivesWhat HSTS preventsThe first-visit gapPreload list requirementsWhy preloading too early is risky
Updated:2026-10-25
Format:Technical Guide
Related tool
Web Security Configuration Workbench

Sign in to check a site's Strict-Transport-Security header and, when preload is set, whether it meets the preload requirements.

Open tool
MemonaIQ

Focused tools for everyday digital work.

  • 18 focused tools
  • 9 run in your browser
Browse all tools Get help

Featured tools

URL Intelligence PlatformImage CompressorInvoice StudioDNS LookupAI Token Counter

Explore

All toolsKnowledge CenterGuidesResourcesCompany

Support

HelpContactSecurity

Legal

PrivacyTermsCookies

© 2026 MemonaIQ. Made in Colombo.

Back to top

MemonaIQ