Skip to content

/config/http/hsts-strict-transport-security

Strict-Transport-Security (HSTS): max-age, includeSubDomains, preload

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · curl 8.21.0 (x86_64-w64-mingw32) libcurl/8.21.0 Schannel zlib/1.3.2updated 2026-10-20
tool
HTTP
file
HTTP response header
key
Strict-Transport-Security
type
max-age=<seconds>[; includeSubDomains][; preload]
default
not sent

Strict-Transport-Security: max-age=63072000; includeSubDomains tells browsers that, for the next two years, this host must be reached only over HTTPS: http:// links are upgraded before any request is sent, and certificate errors cannot be clicked through. Browsers ignore the header when it arrives over plain HTTP.

See a real header

bash
curl -sI https://github.com/ | grep -i '^strict-transport-security'

Output

Strict-Transport-Security: max-age=31536000; includeSubdomains; preload

Directives

DirectiveMeaning
max-age=<seconds>how long the browser remembers the policy; 0 removes it
includeSubDomainsapplies the policy to every subdomain too
preloadconsent to inclusion in browsers' built-in HSTS preload list (hstspreload.org)

Roll it out safely

  1. Make every subdomain work over HTTPS first.
  2. Start with a short max-age (for example 300), check that nothing breaks, then raise it to one or two years.
  3. Add includeSubDomains only when all subdomains serve HTTPS.
  4. Add preload and submit the domain only if you will keep HTTPS forever: removal from the preload list takes months.

Server examples

nginx
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
Apache
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"

Sources