Skip to content
FunnelGuard

Fix guide by FunnelsGuard

HSTS includeSubDomains breaking a subdomain without HTTPS

OPS-063Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

HSTS (HTTP Strict Transport Security) is a response header that tells a browser: only use HTTPS for this site, for a set time. The browser remembers the rule. A typical header looks like Strict-Transport-Security: max-age=31536000; includeSubDomains; preload.

The includeSubDomains part extends the rule to every subdomain, such as shop.example.com, book.example.com or go.example.com. If one of those subdomains only works over HTTP, or has a missing, expired or mismatched certificate, the browser will not load it. Normally a visitor can click past a certificate warning. With HSTS active, that option is removed.

Why it costs you leads or sales

Marketing subdomains often sit on third-party hosts: a landing page builder, a booking widget, a link tracker or a legacy shop. If one of them has no valid HTTPS, visitors who have already seen your main site get a full-page security error. They cannot continue, so they leave. Ad clicks pointing to that subdomain are paid for and wasted.

It is also easy to miss. You and your team may not hit it, because the error appears only for browsers that have cached the HSTS rule. A visitor who never saw your main site may load the subdomain fine, which makes the problem look random.

How a visitor gets locked out
  1. Visit main siteBrowser stores HSTS with includeSubDomains
  2. Click link to subdomainbook.example.com has no valid HTTPS
  3. Browser blocks pageNo 'continue anyway' option
  4. Lead or bookingNever reached

The error happens before any page content loads, so no form, tag or button is reached.

A strict HSTS rule blocks the subdomain

The browser shows a security error instead of your page.

How to check if your site has it

Check your HSTS header and subdomains
  1. Read the header on your main domain

    Run the command below and look for includeSubDomains and preload in the Strict-Transport-Security line.

  2. List your subdomains

    Check your DNS records, plus the links on your site and in your ads, for every subdomain in use (shop, book, go, blog, app, status).

  3. Test each subdomain over HTTPS

    Open each one in a browser and check for a padlock. Look for expired, mismatched or missing certificates, and for pages that only answer on HTTP.

  4. Check the preload list

    Search your domain on hstspreload.org to see whether it is preloaded. If it is, the rule applies even to first-time visitors.

  5. Reproduce as a returning visitor

    Visit the main site first, then the subdomain, in the same browser. A fresh private window will not show the problem unless the domain is preloaded.

Check the HSTS header and a subdomain certificatebash
# See the HSTS header
curl -sI https://example.com | grep -i strict-transport-security

# Check the subdomain over HTTPS (shows certificate errors)
curl -sSI https://book.example.com

# See which names the certificate covers
echo | openssl s_client -connect book.example.com:443 -servername book.example.com 2>/dev/null | openssl x509 -noout -subject -dates -ext subjectAltName

How to fix it

You have two safe routes. The best one is to give the subdomain a valid certificate, so the strict rule is satisfied. The other is to narrow the policy so it no longer covers that subdomain. Pick the first whenever you can, because HTTPS is what visitors and ad platforms expect anyway.

Fix the lockout
  1. Get a valid certificate on the subdomain

    Enable HTTPS at whoever hosts it. Most hosts offer a free managed certificate once the DNS record points to them. Make sure the certificate covers the exact subdomain name.

  2. Redirect HTTP to HTTPS on the subdomain

    Once the certificate works, send plain HTTP requests to the HTTPS address.

  3. If HTTPS is impossible, remove includeSubDomains

    Change the main domain header to max-age=31536000 without includeSubDomains. This only helps visitors once their cached rule expires or is refreshed by a new response.

  4. Never leave preload on by accident

    If you are not preloaded, remove preload from the header. If you are, request removal at hstspreload.org and fix the subdomain in the meantime.

  5. Lower max-age while you test

    Use a short value such as 300 seconds while changing the policy, then raise it once every subdomain works over HTTPS.

Where to change the HSTS header
  1. Find where the header is set

    It may come from a security plugin, your host's control panel, a CDN or the .htaccess file. Check each, because more than one can add it.

  2. Remove includeSubDomains

    In the plugin or host setting, untick the include subdomains option, or edit the header line in .htaccess.

Safer HSTS header for the main domain (nginx)nginx
# Only the main host, no subdomains, no preload
add_header Strict-Transport-Security "max-age=31536000" always;
Safer HSTS header (Apache .htaccess)htaccess
<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=31536000"
</IfModule>
HSTS policy before and after

Before

  • Header includes includeSubDomains and preload
  • book.example.com has no valid certificate
  • Returning visitors see an error with no bypass

After

  • Subdomain has a valid certificate and HTTPS redirect
  • Policy covers only what is ready for it
  • Visitors reach the booking page normally
Try the HSTS settingInteractive
includeSubDomains on, subdomain has no HTTPS

Strict rule, no HTTPS

Leads or data lost

Returning visitors see a security error on the subdomain and cannot continue. Clicks from ads are wasted.

Toggle to compare a strict policy with no HTTPS against a working subdomain.

How to confirm it's fixed

Confirmation checks
  • curl -sSI https://subdomain returns a 200 or a redirect with no certificate error
  • The certificate covers the exact subdomain name and is not expired
  • HTTP on the subdomain redirects to HTTPS
  • The HSTS header on the main domain matches what you intended
  • The page loads in a browser that previously showed the error
  • Your domain is not on the preload list, or removal has been requested

Visitors who already cached the old rule keep it until its max-age ends. If you have fixed the certificate, they are fine. If you only narrowed the header, they stay blocked until the old rule expires. To test as one of them, you can clear HSTS for the domain in your own browser's internal settings, but you cannot do that for your visitors.

How to prevent it happening again

Prevention habits
  • Keep a list of every subdomain you use, including third-party ones
  • Put HTTPS on a new subdomain before linking to it
  • Roll out HSTS in stages: short max-age first, then longer
  • Add includeSubDomains only after every subdomain is checked
  • Add preload only when you are sure, since it is slow to reverse
  • Review the header whenever you move DNS, hosts or CDNs
Safe HSTS rollout
  1. Day 1

    Set max-age=300 and test all subdomains.

  2. Week 1

    Raise max-age to one day once nothing breaks.

  3. Month 1

    Raise to six months, add includeSubDomains if every subdomain has HTTPS.

  4. Later

    Consider preload only after a full audit.

How FunnelGuard handles this

FunnelGuard does not check this yet. Looking at the HSTS header and testing every subdomain for a valid certificate is a possible future check, but it is not part of the product today.

What FunnelGuard does do is run your real customer journeys on a schedule, such as a lead form, checkout or booking button, from the EU or the US. If one of those journeys runs on a subdomain and the page fails to load, the step fails and is re-checked from a second region before one alert goes out with a screenshot and a likely cause. That can show you the effect, but it does not tell you that HSTS is the reason, and a clean test does not prove every visitor is unaffected, since the robot does not carry your returning visitors' cached HSTS rules.

To watch for it yourself, add a calendar reminder to run the curl checks above each month and after any DNS or hosting change. You can also use a free external header and certificate checker, and review the hstspreload.org status for your domain. The Free plan covers 1 site and 2 journeys with daily checks and no card, so you can at least monitor your key subdomain journey.

Questions people ask

Why is my subdomain not loading after I enabled HSTS?

Your HSTS header probably includes includeSubDomains, which forces HTTPS on every subdomain. If the subdomain has no valid certificate or only serves HTTP, the browser blocks it. Add a valid certificate to the subdomain or remove includeSubDomains from the main domain header.

Why can't I click 'proceed anyway' on a certificate warning?

When HSTS applies, browsers remove the option to bypass certificate errors. This is by design, to stop attackers downgrading a secure connection. You must fix the certificate rather than click through.

How do I remove HSTS from a subdomain?

You cannot remove it from only the subdomain if the parent sends includeSubDomains. Remove that directive from the main domain header, or serve the subdomain properly over HTTPS. Visitors who cached the rule keep it until its max-age ends.

Does includeSubDomains affect all my subdomains?

Yes. It applies to every subdomain at every level under the domain that sent the header, including ones you forgot about or that third parties host for you.

How long does an HSTS rule last in the browser?

It lasts for the max-age value in seconds, such as 31536000 for one year. The timer resets each time the browser receives the header again. Lowering max-age does not shorten rules already cached.

How do I undo HSTS preload?

Remove the preload directive from your header, then submit a removal request at hstspreload.org. It can take months to reach all browser versions, so fix subdomain HTTPS first.

How do I check if my site sends HSTS with includeSubDomains?

Run curl -sI https://yourdomain.com | grep -i strict-transport-security, or look in your browser's developer tools under the Network tab response headers. Look for includeSubDomains and preload in the value.

Does FunnelGuard detect HSTS problems on subdomains?

No, not yet. It is a possible future check. FunnelGuard does run your customer journeys on a schedule, so a subdomain page that fails to load during a journey would show as a failed step, but it would not name HSTS as the cause.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

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.