Skip to main content
HeadersCritical PriorityFree

HSTS enabled

Updated November 2026·SecScanner Team

HTTP Strict Transport Security (HSTS) tells browsers to only access your site over HTTPS, preventing protocol downgrade attacks and cookie hijacking.

51% of the 101 most-visited sites we scan fail this check. See the full data.

Results in 1–3 minutes · Free · No signup required

Want the result for your own site? Free HSTS Checker — paste your domain, get the report.

Why It Matters

Without HSTS, attackers can intercept the initial HTTP request before it redirects to HTTPS, enabling man-in-the-middle attacks. HSTS ensures browsers never make insecure requests to your domain.

How We Check

We verify the presence of the Strict-Transport-Security header and check for proper max-age value (minimum 1 year recommended), includeSubDomains directive, and preload eligibility.

Good vs Bad Values

Good and bad values for HSTS enabled
ValueVerdictWhy
max-age=63072000; includeSubDomains; preloadGoodTwo years, all subdomains, eligible for the browser preload list. The target state once every subdomain serves HTTPS.
max-age=31536000; includeSubDomainsGoodOne year with subdomains. The minimum that meets the preload list's max-age requirement.
max-age=31536000WeakProtects the exact host only. A subdomain can still be downgraded and used to set cookies for the parent domain.
max-age=300 (or 86400)WeakFine as the first step of a rollout, too short to protect returning visitors. Raise it in stages.
max-age=0BadTells browsers to forget the HSTS policy for the host. Use only when you deliberately roll it back.
preload without includeSubDomains or with max-age under 1 yearBadThe hstspreload.org submission is rejected, so the directive promises something that never happens.
max-age: 31536000 or max_age=31536000 (typo)BadUnparseable directives are ignored and no policy is stored.
Header present only on the http:// responseBadBrowsers ignore HSTS received over plain HTTP; it must come from the HTTPS response.

How to Fix

Add the header: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload. Start with a short max-age and gradually increase it. Consider submitting to the HSTS preload list.

Nginx — inside the server block that listens on 443:

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

Apache (requires mod_headers):

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

Next.js — next.config.js:

module.exports = {
  async headers() {
    return [{
      source: "/(.*)",
      headers: [{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" }],
    }];
  },
};

Caddy: header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload". Cloudflare: SSL/TLS → Edge Certificates → HSTS, then choose max-age and the subdomain and preload options.

Suggested rollout: 5 minutes, then 1 week, then 1 month, then 1 year, checking for mixed-content or certificate errors at each step. Submit to hstspreload.org only at the end.

Verify with curl -sI https://example.com | grep -i strict-transport-security, and repeat for the www host and a few subdomains. If you use includeSubDomains, also check the HTTPS certificate on every subdomain you can find in DNS.

Common Mistakes

  • Adding `includeSubDomains` or `preload` before every subdomain, including forgotten internal ones, serves valid HTTPS. Preload is very hard to undo.
  • Nginx `add_header` inheritance: if a `location` block declares any `add_header`, the server-level ones are dropped. Repeat the HSTS line or use the `always` flag consistently.
  • Setting HSTS at the origin while a CDN rewrites headers, or the other way round. Check the response the scanner sees.
  • Enabling HSTS before HTTP-to-HTTPS redirects and certificates are solid. A certificate error becomes unbypassable for users once HSTS is cached.
  • Setting a huge `max-age` while testing. The browser remembers it for that long, so a mistake cannot be corrected on the visitor side, and removing the header does not help until the stored policy expires.

Frequently Asked Questions

What is HSTS (HTTP Strict Transport Security)?

HSTS is an HTTP response header (`Strict-Transport-Security`) that instructs browsers to always connect to your site over HTTPS — never HTTP — for a specified period (max-age). Once a browser receives this header, it will refuse to connect via HTTP even if a user types 'http://' in the address bar.

What max-age value should I use for HSTS?

Use at least `max-age=31536000` (1 year) for production sites. Start with `max-age=300` (5 minutes) while testing to avoid locking yourself out if HTTPS breaks. Increase gradually: 5 min → 1 hour → 1 day → 1 week → 1 year. For HSTS preload list eligibility, 1 year is the minimum.

What is HSTS preloading and should I use it?

HSTS preloading hardcodes your domain into browsers' built-in lists (Chrome, Firefox, Safari, Edge) so HTTPS is enforced from the very first visit — before any header is received. To qualify, set `max-age=31536000; includeSubDomains; preload` and submit at hstspreload.org. Warning: preloading is difficult to reverse — ensure all subdomains support HTTPS before submitting.

Should I use includeSubDomains in my HSTS header?

Use `includeSubDomains` only if all your subdomains support HTTPS. It extends HSTS protection to every subdomain, preventing attacks where an insecure subdomain is used to set cookies for the parent domain. If any subdomain doesn't have a valid HTTPS certificate, users won't be able to access it.

Does having an HTTPS redirect replace HSTS?

No. An HTTP→HTTPS redirect only protects users on their second visit onward if they remember to use HTTPS. The first HTTP request is still sent unencrypted and can be intercepted (SSL stripping). HSTS tells the browser to never send that first HTTP request at all.

Related Security Checks

Related Tool

HSTS Checker

Run all 6 related checks with our free hsts checker

Check Your Website Now

Run a free security scan to check for HSTS enabled issues and 61 other security checks.

Scan Your Website Free