SecurityResponse Header

Strict-Transport-Security (HSTS)

Forces modern web browsers to communicate exclusively over encrypted HTTPS connections, preventing SSL stripping and man-in-the-middle (MITM) attacks.

Recommended Production Value
Essential (A+)
max-age=63072000; includeSubDomains; preload

Production Server Implementation

NGINX Configuration Snippet
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

Directives & Syntax Breakdown

max-age=63072000

Duration in seconds (2 years) the browser must remember to force HTTPS for this domain.

includeSubDomains

Applies the HTTPS enforcement rule to all subdomains (api., mail., dev., etc.).

preload

Consents to inclusion in Google Chrome and major browsers permanent hardcoded HSTS preload list.

Common Security Hazards & Pitfalls

  • β€’Never send HSTS on plain HTTP responses. Browsers ignore HSTS over HTTP for security reasons.
  • β€’Only add "preload" if all subdomains permanently support valid SSL/TLS certificates.
Frequently Asked Questions

Strict-Transport-Security (HSTS) - Questions & Answers

Common implementation questions, browser enforcement rules, and debugging.

Once your domain serves HSTS with max-age >= 31536000, includeSubDomains, and preload, submit it at hstspreload.org.