Skip to main content
Security

HSTS (HTTP Strict Transport Security)

Published:
Updated:

HSTS (HTTP Strict Transport Security) is a security mechanism defined in RFC 6797, in which a site uses the Strict-Transport-Security header to declare that, for a given period (max-age), the browser must connect to it exclusively over HTTPS, automatically rewriting all HTTP requests to HTTPS before they are even sent.

An active policy limits SSL stripping and prevents bypassing certificate errors. A first HTTP visit is not protected by a header the browser has not yet received; a browser preload entry for the domain or a covering ancestor can close that gap.

Syntax and directives

  • max-age: lifetime in seconds, refreshed by each valid HTTPS response carrying the header.
  • includeSubDomains: extends protection to all subdomains.
  • preload: signals consent for submission; the keyword alone does not add a domain to browser lists.

Deployment notes

The header only takes effect when sent over HTTPS. Roll out gradually: a short max-age first, then longer values and includeSubDomains, and preload only after ensuring all subdomains (including technical ones) support HTTPS, because removal from the preload list takes months.

Example

A one-year policy with subdomain protection. A typical step before considering preload list submission.

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

Sources & further reading

Check public security signals

Insight analyses headers, TLS and other visible signals, without claiming a pentest.