Skip to content
FunnelGuard

Fix guide by FunnelsGuard

HSTS header missing: how to check for it and add it safely

OPS-062Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

HSTS is a header your server sends with https responses: Strict-Transport-Security. It tells the browser: for the next N seconds, never load this site over http. The browser upgrades the request to https itself, before anything goes over the network.

When the header is missing, your site may still work over https. But the browser has no memory that https is required. Every visit that starts with http:// (an old link, a typed domain, a printed URL) first reaches your server in plain text and only then gets redirected.

Why it costs you leads or sales

The risk is modest but real. On the first http request, someone on the same public Wi-Fi can read or change the traffic before the redirect happens. That can mean stripped redirects, injected content or stolen session cookies. A visitor who sees a browser warning on a form or checkout page often leaves.

There is also a small speed cost. Without HSTS, every http entry point costs an extra round trip to your server for the redirect. Security scanners, enterprise security reviews and some client audits also list a missing HSTS header as a finding, which can slow a deal.

First visit without HSTS
  1. Visitor clicks http linkOld link, typed domain or printed URL
  2. Plain http requestSent unencrypted; can be read or changed
  3. Redirect to httpsOnly happens if the request survives
  4. Form or checkoutVisitor may never get a safe session

The first request goes out as plain http, which is the exposed step.

How to check if your site has it

Check the response headers of your https homepage. You are looking for a strict-transport-security line.

Check with curlbash
curl -sI https://www.example.com | grep -i strict-transport-security

No output means the header is missing. In Chrome you can also open DevTools, go to the Network tab, reload, click the first request and read Response Headers. Test both the www and the apex (non-www) hostnames, and any checkout or booking subdomain.

What the result means
ResultMeaningAction
No headerHSTS not enabledAdd it, starting with a short max-age
max-age=300Testing stageRaise it once all is fine
max-age=31536000One year, the common long-term valueGood
max-age=0HSTS switched offSet a real value

How to fix it

Roll out HSTS in stages
  1. Make sure https works everywhere

    Every page, the www and apex hostnames, and any subdomain you plan to cover must load over https with a valid certificate. Redirect http to https first.

  2. Add the header with a short max-age

    Use Strict-Transport-Security: max-age=300 (5 minutes). Use the platform steps below.

  3. Test your key journeys

    Load the homepage, forms, checkout and any subdomains in a browser and check for certificate errors.

  4. Raise max-age gradually

    Move to one day (86400), then one week (604800), then one year (31536000).

  5. Consider includeSubDomains

    Add it only when every subdomain is served over https. Add preload only if you understand it: preload submission is hard to reverse.

Add the header on your platform
  1. Add it at the server

    Best place is the web server config (see the Custom code tab for Apache and nginx). Without server access, a header plugin or your host's security settings may offer an HSTS option; check what your host provides.

  2. Check for conflicts

    Make sure two plugins or the host do not each add the header, which creates duplicates.

nginx: testing stagenginx
server {
  listen 443 ssl;
  server_name www.example.com;
  add_header Strict-Transport-Security "max-age=300" always;
}
Apache: long-term valuehtaccess
<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=31536000"
</IfModule>
Response headers

Before

  • No Strict-Transport-Security header
  • Browser starts on http for old links
  • Relies on a redirect every time

After

  • Header sent on every https response
  • Browser upgrades to https by itself
  • Redirect still in place as a backup

How to confirm it's fixed

Confirmation checks
  • curl -sI shows strict-transport-security on the www hostname
  • The apex hostname returns it too, or redirects to a host that does
  • The header appears once, not duplicated
  • Forms, checkout and booking pages still load over https
  • Subdomains still load if you used includeSubDomains
  • max-age is the value you intended

How to prevent it happening again

Headers are often lost when you change hosts, add a CDN or rebuild server config. Keep the HSTS line in your documented server or CDN config, not in a one-off manual edit. Re-run the curl check after any hosting, CDN or DNS change, and add it to your launch checklist for new sites and subdomains.

How FunnelGuard handles this

FunnelGuard does not check for a missing HSTS header today. It is a possible future check, not a current feature.

What FunnelGuard does do is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US and check each step. If a change to https settings breaks a page or form, that broken journey step is what the check can show, with a screenshot and a likely cause. It will not tell you the header is absent.

To watch for HSTS yourself, add the curl command above to a monthly checklist, or use a free online header scanner on your key hostnames after each hosting or CDN change.

Questions people ask

What does a missing HSTS header mean?

It means your server does not send a Strict-Transport-Security header, so browsers do not remember that your site must use https. Visits that start on http make one unprotected request before being redirected.

How do I add an HSTS header?

Add a Strict-Transport-Security header at your web server, host or CDN. In nginx use add_header, in Apache use Header always set, and in Cloudflare use the HSTS option under SSL/TLS, Edge Certificates. Start with max-age=300.

What max-age should I use for HSTS?

Start with 300 seconds while you test, then raise it to a day, a week and finally 31536000 (one year). One year is the common long-term value.

Can HSTS break my website?

Yes, if a covered hostname has no valid https setup. Browsers will refuse to load it over http and show an error. Start with a short max-age and only use includeSubDomains once every subdomain works on https.

Do I still need an http to https redirect if I use HSTS?

Yes. HSTS only applies after a browser has received the header over https once. The redirect handles first-time visitors, other clients and old links.

How do I check if HSTS is enabled on my site?

Run curl -sI https://yourdomain.com and look for a strict-transport-security line. You can also open Chrome DevTools, go to Network, click the first request and read the response headers.

Can I add HSTS in Shopify, Wix or Squarespace?

Usually not directly, because these platforms control response headers. Check what your domain sends with curl, and contact the platform's support if you need it changed.

Does FunnelGuard check for a missing HSTS header?

No, not yet. It is a possible future check. FunnelGuard currently runs your customer journeys and checks each step, so you would use curl or a header scanner for HSTS.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: site safety (Stage 26, daily): HSTS header.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.