Skip to main content
All Terms Glossary

HSTS (Strict Transport Security)

Definition

HTTP Strict Transport Security is a security policy mechanism that helps protect websites against protocol downgrade attacks and cookie hijacking. It allows web servers to declare that browsers should interact with them only via secure HTTPS connections. Once set, HSTS prevents users from bypassing certificate warnings and ensures encrypted connections.

How HSTS works

HTTP Strict Transport Security is a response header a server sends over HTTPS, for example Strict-Transport-Security: max-age=31536000; includeSubDomains; preload. Once a browser sees it, it remembers for the stated max-age that this host must only ever be reached over HTTPS. For the duration, the browser rewrites any http:// link to the site to https:// before a request leaves the machine, and it converts recoverable TLS certificate warnings into hard, unbypassable errors. The optional includeSubDomains flag extends the rule to every subdomain, and preload lets the policy be baked into browsers so it applies even on the very first visit.

Why HSTS matters

A plain redirect from HTTP to HTTPS still exposes one insecure request, and that first request is exactly where an SSL-stripping attacker operates: they sit on the network, keep their own connection to the victim on plain HTTP, and quietly proxy to the real site over HTTPS, harvesting cookies and credentials. HSTS removes that window by refusing to make the insecure request at all. It also stops users from clicking through certificate warnings, which defeats man-in-the-middle attacks that rely on a forged or invalid certificate. In short, HSTS turns HTTPS from a preference the user can be tricked out of into an enforced guarantee.

Deploying HSTS safely

Confirm every hostname and subresource genuinely works over HTTPS first, because once a browser caches the policy there is no easy escape until max-age expires. Roll out with a short max-age, verify nothing breaks, then raise it to a year or more. Add includeSubDomains only when you are certain no subdomain needs HTTP, and submit to the preload list only when the whole domain tree is HTTPS-ready. HSTS is one of several security headers; it protects the transport but not the content that rides over it. Monitoring what third-party scripts actually do, as cside does through payload analysis, remains a separate and complementary layer.

Definition

What happens on the very first visit before HSTS is cached?

Without preloading, the browser has never seen the header, so the first request can still go over HTTP and is vulnerable to SSL stripping. The HSTS preload list solves this by shipping the policy inside the browser itself, so enforcement applies from the first-ever connection to the domain.

Definition

Can I turn HSTS off quickly if something breaks?

Not for users who already cached the policy. Sending max-age=0 tells browsers to forget it, but only takes effect the next time each browser reaches the site over HTTPS. Preloaded domains are even slower to remove. This is why you test HTTPS coverage thoroughly before committing to a long max-age.

Got more questions

Talk to a security expert

We answer client-side security questions every day. Bring yours.

Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead