/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
curl -sI https://github.com/ | grep -i '^strict-transport-security'Output
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Directives
| Directive | Meaning |
|---|---|
| max-age=<seconds> | how long the browser remembers the policy; 0 removes it |
| includeSubDomains | applies the policy to every subdomain too |
| preload | consent to inclusion in browsers' built-in HSTS preload list (hstspreload.org) |
Roll it out safely
- Make every subdomain work over HTTPS first.
- Start with a short
max-age(for example300), check that nothing breaks, then raise it to one or two years. - Add
includeSubDomainsonly when all subdomains serve HTTPS. - Add
preloadand submit the domain only if you will keep HTTPS forever: removal from the preload list takes months.
Server examples
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"Sources
Related pages
flags · httpSet-Cookie attributes: SameSite, Secure, HttpOnly, Max-AgeSet-Cookie attributes decide when browsers send a cookie: SameSite controls cross-site requests, None needs Secure, HttpOnly hides it from JavaScript.errors · corsblocked by CORS policy: No 'Access-Control-Allow-Origin' headerThe browser blocks a cross-origin response without Access-Control-Allow-Origin. Fix it on the server by sending the header for your origin, or proxy the API.codes · httpHTTP status codes: 1xx to 5xx with meaning and common causesHTTP status codes explained: 200 and 204, the redirects 301 to 308, client errors 400 to 429 and server errors 500 to 504, each with its most common cause.