Defaults.Exposed

Defaults.ExposedFixes › HSTS (Strict-Transport-Security)

How to fix HSTS (Strict-Transport-Security)

HSTS is a one-line instruction your website gives every browser: 'always come back to me over the secure, encrypted connection — never the insecure one.' Without it, your padlock can be quietly stripped away on shared WiFi, and the very first visit to your site is exposed.

Bottom line for your business: Having HTTPS (the padlock) is not the same as enforcing it. Without HSTS, an attacker on the same WiFi as your customer can silently downgrade the connection to plain, unencrypted HTTP — capturing logins, card details and form data while the customer sees nothing wrong. Your SSL certificate, which you may be paying for, is bypassed. The fix is free and takes about 15 minutes for whoever runs your site.

What this can cost you

Why it matters. HTTPS protects a connection once it is encrypted — but it does not force browsers to use it. Attackers exploit that gap with 'SSL stripping': on any shared network they quietly keep the visitor on insecure HTTP, reading everything. HSTS tells the browser to refuse plain HTTP for your domain entirely, for a long time, so the gap closes after the first visit. It is a single response header, free to add, and on our scoring it is worth real points because a missing or too-short value leaves every visitor on public WiFi exposed.

What this is, in plain words

You almost certainly have HTTPS — the little padlock in the browser bar. Good. But here is the part almost nobody is told: having HTTPS is not the same as forcing it.

HTTPS makes a connection encrypted once the browser decides to use it. HSTS — short for HTTP Strict Transport Security — is the instruction that makes the browser always use it. It’s a single, invisible line your website sends to every visitor that says, in effect:

“From now on, for my domain, only ever talk to me over the secure connection. Never the insecure one. Don’t even try.”

The browser remembers that and obeys it for as long as you tell it to — typically a year. After a visitor’s first secure visit, their browser will simply refuse to load your site over plain, unencrypted HTTP, even if something tries to force it.

Without HSTS, that “always use the secure version” rule doesn’t exist — and attackers know exactly how to exploit the gap.

What this can cost you

These are realistic, everyday scenarios. We never name a real business; these are illustrations of how the gap gets used.

  1. The coffee-shop checkout. A customer opens your shop on cafe WiFi and goes to check out. An attacker on the same network runs a free, well-known tool that keeps the customer on plain HTTP instead of HTTPS. The customer sees what looks like your normal site — no warning, no broken padlock in the spot they’d glance — and types their card details. The attacker reads every keystroke. Your SSL certificate did nothing, because the connection was never allowed to become secure in the first place.

  2. The travelling employee. A staff member logs into your admin panel or webmail from a hotel or airport. The same downgrade trick captures their username and password. Now the attacker has a way into your business — not because your password policy was weak, but because the login page was reachable over insecure HTTP.

  3. The deal that stalls. A larger customer sends you their standard security questionnaire before signing. One line asks: “Does your website enforce HTTPS via HSTS?” Your IT contact has to answer “no,” and the procurement process pauses while you scramble to fix a free, 15-minute setting that now looks like a red flag in front of a buyer.

  4. The cyber-insurance or compliance check. An insurer’s scan, or an auditor reviewing your data-protection posture, flags the missing header. Encryption of personal data is an explicit expectation under data-protection rules (GDPR Article 32), and “we have a certificate but don’t enforce it” is a weak place to be standing.

  5. The false sense of security. You’re paying for SSL, the padlock shows, and everyone assumes the site is safe. It mostly is — until a customer is on a shared network, which is exactly when they’re most vulnerable and least likely to notice anything wrong.

The through-line: the cost isn’t abstract. It’s a real customer’s card or login, captured at the worst possible moment, with no alarm going off.

What it actually is

When a browser asks your website for a page, your server sends back the page plus some invisible “headers” — extra instructions the browser reads but the visitor never sees. HSTS is one of those headers:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Three parts matter:

Why “the first visit” matters

HSTS has one inherent limitation: a browser only obeys the rule after it has seen the header at least once. So a brand-new visitor’s very first connection is still a tiny window of exposure. Two things narrow it: an HTTP-to-HTTPS redirect (which gets them onto the secure version fast) and preload (which removes the window entirely). That’s why a complete setup pairs HSTS with a proper redirect.

What “good” looks like — and how it’s scored

Our check reads your live header and grades the max-age:

max-age valueWhat it meansResult
1 year or more (≥ 31536000)Excellent — the recommended settingFull marks
6 months or more (≥ 15768000)Good, but not the full yearPartial
1 day or more (≥ 86400)Weak — too short to be reliableLow / partial
Under 1 day, or no header at allEffectively no protectionFail (high severity)

So a header that exists but is set to a few minutes is treated as a fail — it looks configured but isn’t doing the job. Aim for one year. The check also notes whether includeSubDomains and preload are present.

How to fix it (free, ~15 minutes)

Hand this section to whoever runs your website — your IT person, web developer, or hosting support. The fix is free. It is a single header, or a toggle in your hosting platform. There is nothing to buy.

One important ordering rule first: HSTS is sticky — once enabled, browsers will refuse plain HTTP for your domain for the full max-age. So confirm HTTPS works correctly on your main site and every subdomain before turning it on broadly. The safe path is: test with a short value → confirm nothing breaks → raise to one year.

Step 1 — Make sure HTTPS already works everywhere

Visit your site and key subdomains over https:// and confirm they load cleanly with a valid certificate. Also confirm plain http:// requests redirect to https://. (If they don’t, fix the HTTP-to-HTTPS redirect first — HSTS assumes it’s in place.)

Step 2 — Add the header (pick your platform)

Cloudflare (or similar CDN): This is the easiest. Go to SSL/TLS → Edge Certificates → HTTP Strict Transport Security (HSTS) and enable it. Set Max-Age to 6 months or 12 months, and enable “Apply HSTS policy to subdomains” once you’re sure all subdomains are on HTTPS.

Nginx: add inside your HTTPS server block:

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

Apache: ensure mod_headers is enabled, then add to your HTTPS virtual host:

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

Microsoft IIS: add to web.config inside <customHeaders>:

<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains; preload" />

Google Workspace / Microsoft 365 note: these power your email, not your website hosting — HSTS is set wherever your public website actually lives (your CDN, web server or site builder), not in Workspace/365 admin. If your site is on a builder like Squarespace, Wix or Shopify, HSTS is usually handled for you; check their SSL/security settings if our check flags it.

Step 3 — Test small, then commit

Start with max-age=300 (5 minutes). Confirm the site still loads perfectly everywhere. Then raise it to max-age=31536000 (one year). That’s the full-marks setting.

Step 4 (optional, gold standard) — preload

Once you’re confident and have run a one-year header with includeSubDomains for a while, you can submit your domain at hstspreload.org to be baked into browsers. This closes the first-visit window entirely. Treat it as a deliberate commitment — removing a domain from the list is slow.

Common mistakes

FAQ

We already have HTTPS and the padlock shows. Isn't that enough?

No — and this is the single most common misunderstanding. The padlock means a connection CAN be encrypted; it does not force browsers to use the encrypted version. Without HSTS, an attacker on the same network can keep a visitor on plain HTTP (called SSL stripping) and read everything they type, while the customer sees a normal-looking site. HSTS is the instruction that makes 'encrypted only' mandatory. HTTPS without HSTS is a locked door that isn't actually latched.

Is this expensive or risky to turn on?

The fix itself is free — it's one line in your web server or a toggle in your CDN — and takes about 15 minutes. The one real caution: HSTS is sticky. Once a browser sees it, it will refuse plain HTTP for your domain for as long as you specified. So you must be confident HTTPS works on your main site AND every subdomain before enabling it broadly. Start with a short test value, confirm nothing breaks, then raise it to a year. Done in that order, the risk is negligible.

What does 'good' actually look like?

A max-age of at least one year (31536000 seconds). Our check awards full marks at a year or more, partial marks at six months, weak/partial at a day, and treats anything under a day as effectively absent. The strongest setup also adds includeSubDomains (covers shop.yoursite.com, app.yoursite.com, etc.) and preload (bakes protection into browsers so even the very first visit is safe).

What is 'preload' and do we need it?

HSTS only protects a visitor AFTER their browser has seen the header at least once — so a brand-new visitor's first request is still a small window. The HSTS preload list, built into Chrome, Firefox, Safari and Edge, closes that window by shipping your domain to browsers in advance. It's optional and a slightly bigger commitment (removal is slow), but it's the gold standard. For most small businesses, a one-year max-age with includeSubDomains is already a strong, safe result; preload is the extra step once you're settled.

We're on Squarespace / Wix / Shopify — do we even need to do anything?

Most fully-hosted website builders (Squarespace, Wix, Shopify and similar) enforce HTTPS and often set HSTS for you automatically — so you may already pass with nothing to do. The exception is when you use a custom domain or CDN in front of your site; then the setting can fall through the gaps. Run the check: if it passes, you're done. If it flags, the fix is the toggle in your platform's SSL/security settings, or one line at your CDN.

If we don't fix it, does it lower our grade?

Yes. HSTS is a scored web-security check, not informational — a missing or too-short header costs points and is rated high severity, because it directly exposes your visitors' data on shared networks. It's also one of the cheapest points to recover: a single free header, about 15 minutes of work.