tools / HTTP reference / strict-transport-security (hsts) header
HTTP · RFC 6797 (HSTS)

Strict-Transport-Security header

HSTS tells browsers to ALWAYS use HTTPS for this domain, for the next N seconds. Defends against SSL-strip attacks. Once set, you can't easily un-set without breaking returning users.

advanced RFC 6797 (HSTS)

What the RFC says

The HTTP Strict Transport Security (HSTS) policy ... allows web sites to declare themselves accessible only via secure connections and/or for users to be able to direct their user agent(s) to interact with given sites only over secure connections. (RFC 6797 §1) — RFC 6797 (HSTS)

Example

Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
# 2 years, all subdomains, eligible for browser preload list

# Testing/rollback-safe:
Strict-Transport-Security: max-age=300
# 5 minutes — short window, recoverable

Real-world implementations

Common misuses (don't do this)

Use cases

Get the RFC reference for any HTTP response
httpwut takes a curl response and explains the status code + headers + the RFC sections you should actually read. Built for HTTP debugging that goes deeper than 'lol 500'.
Open httpwut  

Related HTTP topics

cors headers explained (access-control-*) · cors headers explained (access-control-*) · cors headers explained (access-control-*) · cors headers explained (access-control-*)