Strict-Transport-Security (HSTS) header
One of the checks in every audibot report. This page says exactly what audibot reads, what passes, and how to fix it.
What audibot checks
The Strict-Transport-Security header on the HTTPS response of the home page, after following redirects, and the max-age it sets.
- Pass
The header is set with a
max-ageof at least 15552000 seconds (six months). - Warning
The header is set, but
max-ageis under 15552000. - Fail
No HSTS header.
Why it matters
Without HSTS, a browser that is sent to http:// will make that plain request first, and someone on the same network can answer it instead of the site. HSTS tells the browser to use HTTPS for this host for max-age seconds without asking.
How do I add an HSTS header, and what max-age should it have?
Send the header on every HTTPS response. 31536000 (a year) is the usual value. Add includeSubDomains only once every subdomain serves HTTPS, because browsers will refuse plain HTTP on all of them.
nginx (inside the HTTPS server block)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;Apache (mod_headers)
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"Caddy
example.com {
header Strict-Transport-Security "max-age=31536000; includeSubDomains"
}Cloudflare
SSL/TLS → Edge Certificates → HTTP Strict Transport Security (HSTS) → Enable,
with Max Age of 6 months or more.Related tools
- Security headers checker — Check the HTTP security headers sent by a homepage.
- Security headers generator — Write security header settings for your web server or hosting platform.
Other checks in Security headers
- Content-Security-Policy header
- X-Content-Type-Options: nosniff
- Clickjacking protection (frame-ancestors / X-Frame-Options)
- Referrer-Policy header
- Permissions-Policy header
- Software versions in response headers
- Cookie flags: Secure, SameSite and HttpOnly
- security.txt
Security headers in the methodology ·All guides
This check is one step of the website launch checklist.
How often audited websites pass this check: see the website audit benchmarks, with sample size and denominators.
Check your site
audibot runs this check and every other one in a single audit, and publishes the report with a recommendation for each finding.