Raise the HSTS max-age on Netlify
Why it matters
A short HSTS lifetime means browsers forget the HTTPS-only rule quickly, so visitors who return later are exposed again. A lifetime of at least six months, and ideally one year, keeps them protected.
Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.
The fix
- Raise the value in your _headers file or netlify.toml and deploy.
- Check with curl -sI https://example.com/ that the new value is sent, and watch for problems before any further increase.
_headers
/* Strict-Transport-Security: max-age=31536000
The examples use example.com. Replace it with your own domain.
Related
- Reported by the HSTS check
- Add the Strict-Transport-Security (HSTS) header
- Fix the malformed Strict-Transport-Security header
- Re-enable HSTS (max-age is zero)
- Decide whether to add includeSubDomains
- Meet the HSTS preload requirements or remove preload
- Consider submitting the domain to the HSTS preload list
Scan your domain to see whether this applies to you.