How to fix a missing HSTS header
HSTS is one of the quickest security wins for any website. If Vigil flagged a missing Strict-Transport-Security header, here's how to fix it.
What HSTS does
Strict-Transport-Security tells the browser to only ever connect to your site over HTTPS, even if someone types http:// or clicks an old link. Without it, a first-time or man-in-the-middle visitor can be downgraded to plain HTTP.
The header to add
Send: Strict-Transport-Security: max-age=31536000; includeSubDomains. Start without 'preload' until you're sure every subdomain is HTTPS-only.
nginx
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; inside your server block (port 443).
Apache
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" (mod_headers enabled).
IIS
Add a custom HTTP response header named Strict-Transport-Security with the value above, under HTTP Response Headers for the site.