Docs Security
HSTS header
Checks for a Strict-Transport-Security header with a max-age of at least 180 days, so browsers go straight to HTTPS on every visit.
What it checks
We read the Strict-Transport-Security header on the homepage response, after redirects.
The check reads the max-age value, in seconds. It needs at least 15552000 seconds, which is 180 days. includeSubDomains and preload are not required to pass.
- PassThe header is set with a max-age of 180 days or more.
- WarningThe header is set, but max-age is shorter than 180 days or missing.
- FailNo Strict-Transport-Security header.
Why it matters
Even with a redirect in place, the first request a browser makes to http:// is unprotected, and someone on the network can intercept it before the redirect happens.
HSTS tells the browser to use HTTPS for your domain for the next max-age seconds without asking. After the first visit, the http:// step never happens.
How to fix it
Send the header on HTTPS responses with a max-age of at least 180 days. One year is a common choice.
Browsers remember the setting for the whole max-age, so only send it once HTTPS works across the site. If you are unsure, start with a short max-age, check nothing breaks, then raise it. Add includeSubDomains only when every subdomain works over HTTPS. Preloading is a separate step that is slow to undo.
Platform notes
Turn on HSTS under SSL/TLS, Edge Certificates, and choose the max-age there.
On Nginx, use add_header with the always flag in the HTTPS server block. On Apache, use Header always set with mod_headers enabled.
Set the header in the headers() function in next.config.js, in vercel.json, or in a Netlify _headers file or netlify.toml.
Add it in your server config, through your host, or with a security plugin that can set response headers.
These platforms control the response headers on their own hosting, so there is usually no setting for this header in the site editor. If you need it, ask the platform's support what your plan allows.
Your report shows what this check found on your site. Pro shows the exact fix for your site. See pricing.
Questions
What is HSTS preload?
A list built into browsers of domains that always use HTTPS, even on the very first visit. Joining needs includeSubDomains, a long max-age and the preload flag, and leaving takes months, so it is optional and not needed to pass this check.
Free, about 30 seconds, with every other check included.