HTTPS and certificate
Strict-Transport-Security
The Strict-Transport-Security (HSTS) header tells browsers to use HTTPS for your site for a set time, so later visits can't be downgraded to HTTP.
Why it matters
Even with an HTTP-to-HTTPS redirect, the first request still goes out over HTTP, and an attacker on the network can intercept it. HSTS makes the browser skip HTTP entirely on later visits.
What Scanetra looks for
- A valid Strict-Transport-Security header on the HTTPS page, with max-age above 0.
- A max-age under six months (a note, not an issue).
It reads only your homepage's public response. How a scan works
How to fix it
nginx
In the server block that serves HTTPS. The always flag also adds it to error pages.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;Apache
Needs mod_headers. In the VirtualHost or .htaccess.
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"Cloudflare
Rules › Transform Rules › Modify Response Header: create a rule for all incoming requests that sets the static header Strict-Transport-Security to the value below.
max-age=31536000; includeSubDomainsVercel
In vercel.json at the root of the project.
{
"headers": [
{
"source": "/(.*)",
"headers": [{ "key": "Strict-Transport-Security", "value": "max-age=31536000; includeSubDomains" }]
}
]
}Netlify
In a file named _headers in the publish directory.
/*
Strict-Transport-Security: max-age=31536000; includeSubDomainsBefore you add includeSubDomains
Only add it if every subdomain works over HTTPS. Otherwise use max-age=31536000 alone. Start with a short max-age if you're unsure, and raise it once everything works.
Replace example.com with your own domain, and test changes on a staging copy first where you can.
Check that it worked
The response headers of https://your-site/ include Strict-Transport-Security. Then scan again.
Check your own site
A free scan tells you whether your site passes this check, and the 24 others.