HTTP Strict Transport Security (HSTS), defined in RFC 6797, eliminates that window by instructing browsers to rewrite every future connection for your host to https:// internally before a single packet leaves the device. Submitting your domain to the HSTS Preload List (hstspreload.org) closes even the very first visit by baking that HTTPS-only rule directly into Chrome, Firefox, Safari and Edge binaries.
Done carefully, HSTS preloading is one of the highest-leverage transport hardening steps a web team or agency can ship. Done carelessly — by pasting includeSubDomains; preload on day one without auditing staging, mail or internal subdomains — it can lock browsers out of legacy hosts for months.
What hstspreload.org actually requires (and why teams get rejected)
Many teams add a basic Strict-Transport-Security: max-age=31536000 header and assume they are done, only to fail preload validation or miss subtle redirect flaws. According to the Chromium HSTS Preload requirements, a domain must satisfy every single rule below simultaneously:
- Valid TLS certificate on the apex domain and every subdomain: Self-signed, expired or hostname-mismatched certificates cause hard non-bypassable browser errors once HSTS is active.
- Redirect plain
http://tohttps://on the same host first: If your canonical site ishttps://www.example.com, port 80 onhttp://example.commust redirect tohttps://example.comfirst, and only then redirecthttps://example.comtohttps://www.example.com. Jumping directly fromhttp://example.comtohttps://www.example.comskips the HTTPS apex response, so browsers never receive the apexStrict-Transport-Securityheader. - Permanent redirect status (
301or308): Temporary302or307redirects signal to crawlers and browsers that HTTP enforcement may change. Use301 Moved Permanently(or308 Permanent Redirectfor APIs that must preservePOSTbodies). - Serve all subdomains over HTTPS: Including
www,staging,dev,mail,webmail,portal, marketing microsites, and internal tools reachable on your corporate DNS zone. - Send the full preload-eligible header on the HTTPS apex response:
- max-age of at least 31536000 seconds (one full year; two years, 63072000, is the standard production target). - The includeSubDomains directive. - The preload directive.
- Never emit
Strict-Transport-Securityover plain HTTP: Per RFC 6797, browsers strictly ignore HSTS headers received on unencryptedhttp://responses; sending the header only onhttps://server blocks keeps configurations unambiguous.
Check it now. The HSTS preload & HTTPS enforcement checker checks Strict-Transport-Security max-age, includeSubDomains and preload eligibility, verifies plain http:// to https:// permanent 301/308 redirects, and tests TLS 1.2/1.3 and legacy TLS 1.0/1.1 rejection; the security headers checker reads a page’s HSTS, CSP, X-Content-Type-Options, frame protection, Referrer-Policy and Permissions-Policy. No account, and the address is not stored.
The four-stage safe rollout sequence
Never enable max-age=63072000; includeSubDomains; preload on an unaudited production domain in one jump. Removing a domain from browser preload lists requires waiting for browser release cycles, which takes months across Chrome, Safari, Edge and Firefox. Follow a calm four-stage ramp instead:
- Stage 1 — Inventory every DNS subdomain first: Export the full DNS zone from Cloudflare, Route 53, Hetzner DNS or cPanel and check every
A,AAAAandCNAMEhost for valid HTTPS. Pay close attention to forgotten client portals, staging environments, Matomo or newsletter tracking subdomains, and third-party SaaS CNAMEs. - Stage 2 — Five-minute canary (
max-age=300): ShipStrict-Transport-Security: max-age=300; includeSubDomainsand test your primary site, checkout, admin panels and subdomains across browsers. If an unencrypted legacy subdomain breaks, revert the header or setmax-age=0and wait five minutes for browsers to clear it. - Stage 3 — One-week to one-month soak (
max-age=604800thenmax-age=2592000): Run for at least one full billing, reporting and deployment cycle so seasonal cron dashboards, partner portals and client editors confirm HTTPS works everywhere without warnings. - Stage 4 — Full preload commitment (
max-age=63072000; includeSubDomains; preload): Once every subdomain passes cleanly and port 80 redirects permanently to HTTPS on hop 1, publish the full two-year header and verify your domain onhstspreload.org.
Copy-paste server configurations (Nginx, Apache, Cloudflare)
Nginx (server blocks for port 80 and port 443)
# Port 80: permanent same-host upgrade to HTTPS
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
# Port 443: modern TLS + preload-ready HSTS on every response (including 4xx/5xx)
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com www.example.com;
ssl_protocols TLSv1.2 TLSv1.3;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
}Notice the always parameter in Nginx add_header. Without always, Nginx omits Strict-Transport-Security on 301, 302, 404 and 500 responses — which causes hstspreload.org validation to fail whenever your apex domain redirects https://example.com to https://www.example.com.
Apache (.htaccess or VirtualHost)
# Enforce permanent HTTPS upgrade on port 80
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Send HSTS only on HTTPS responses
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" env=HTTPS
</IfModule>Cloudflare edge settings
When Cloudflare proxies your domain, configure two settings inside SSL/TLS → Edge Certificates:
- Enable Always Use HTTPS so Cloudflare upgrades port 80 requests with a
301redirect at the edge. - Configure HTTP Strict Transport Security (HSTS) with Max Age = 12 months (or custom header for 24 months), Apply HSTS policy to subdomains, and Preload only after completing Stage 1–3 above.
- Set Minimum TLS Version to TLS 1.2 so deprecated TLS 1.0 and TLS 1.1 handshakes are refused in accordance with RFC 8996.
Common production regressions after enabling HSTS
Even mature engineering teams break HSTS months after launch during routine infrastructure changes:
- Nginx nested
add_headerinheritance traps: Adding a singleadd_header Cache-Control ...;inside alocationblock silently drops everyadd_headerinherited from the parentserverblock — includingStrict-Transport-Security. Always verify headers on both/and key subpaths after editing Nginx configs. - CDN or proxy migrations dropping edge headers: Moving DNS off Cloudflare or switching reverse proxies resets edge-injected HSTS unless the origin web server also emits the header.
- Expiring certificates becoming hard outages: Without HSTS, a visitor might click through a browser warning in an emergency. With HSTS active, browsers remove the bypass button completely — making early certificate expiry alerts (30, 14 and 7 days before expiry) non-negotiable.
- Legacy TLS 1.0 or TLS 1.1 creeping back on load balancers: Default listener profiles on new cloud load balancers or hosting panels occasionally enable TLS 1.0/1.1 unless explicitly locked to TLS 1.2 and TLS 1.3.
Quick curl verification commands
# 1. Verify port 80 sends a permanent 301/308 redirect straight to https://
curl -sSI http://example.com/ | grep -iE '^(HTTP/|location:)'
# 2. Verify HTTPS apex sends Strict-Transport-Security (even when redirecting to www)
curl -sSI https://example.com/ | grep -iE '^(HTTP/|location:|strict-transport-security:)'How Beamfar helps
Check any public domain right now with zero login using the free, zero-storage HSTS preload & HTTPS enforcement checker. It inspects Strict-Transport-Security against RFC 6797 and hstspreload.org directives, traces port 80 redirection, and verifies TLS certificate health and legacy TLS 1.0/1.1 refusal in one pass with copy-paste Nginx, Apache, Cloudflare and staged rollout snippets. Pair it with our security headers checker and SSL certificate checker, or add your domains to Beamfar for continuous two-region EU uptime, early TLS expiry alerts and daily external security header drift detection.
Sources
Read on . Standards and vendor pages change; confirm the current text before you rely on it.
- IETF RFC 6797 — HTTP Strict Transport Security (HSTS) (www.rfc-editor.org)
- Chromium HSTS Preload List Submission Requirements (hstspreload.org)
- MDN Web Docs — Strict-Transport-Security HTTP Header (developer.mozilla.org)
- IETF RFC 8996 — Deprecating TLS 1.0 and TLS 1.1 (www.rfc-editor.org)