HSTS check: Strict-Transport-Security header

Short answer

HSTS (HTTP Strict Transport Security) is a response header that tells browsers to use https:// for your domain for a set time, even if someone types http://. SiteShield passes it when max-age is at least 6 months (15,552,000 seconds). Recommended value: Strict-Transport-Security: max-age=31536000; includeSubDomains

EncryptionWorth 10 of 100 pointsBy Mumshad JawadUpdated

What is HSTS?

HSTS is defined in RFC 6797. After a browser sees the header once over HTTPS, it rewrites every later http:// request for that domain to https:// internally, before anything is sent on the network. max-age is how long (in seconds) the browser remembers this; includeSubDomains applies it to every subdomain; preload asks to be listed in browsers' built-in HSTS list.

Why it matters

HSTS tells browsers to never load your site over plain HTTP again, closing the gap that the first redirect leaves open.

A redirect still leaves the very first http:// request exposed, which is exactly what SSL-stripping tools target on public Wi-Fi. HSTS removes that request entirely for returning visitors. It also stops visitors from clicking through certificate warnings on your domain.

SiteShield maps this check to:

OWASP ASVS V14.4Mozilla web security guidelines

See how these standards fit together in the UAE website security checklist.

How SiteShield grades it

This check, "HSTS (Strict-Transport-Security)", can cost up to 10 points: a fail loses all 10, a warning loses 5. Every scan starts at 100.

ResultWhenPoints lost
FailNo Strict-Transport-Security header on the homepage response.10
WarningThe header is present but max-age is below 15,552,000 seconds (about 6 months).5
PassThe header is present with max-age of 6 months or more. includeSubDomains is reported but not required.0

How to check it yourself

Look for the header on your homepage over HTTPS:

curl -sI https://example.com | grep -i strict-transport-security
# strict-transport-security: max-age=31536000; includeSubDomains

Or run a free SiteShield scan, which checks this and 16 other settings in one go.

How to fix it

The quick version: Send the header: Strict-Transport-Security: max-age=31536000; includeSubDomains

Cloudflare

  1. Go to SSL/TLS → Edge Certificates → HTTP Strict Transport Security (HSTS) and enable it.
  2. Set Max Age to 12 months. Turn on Include subdomains only if every subdomain works over HTTPS. Leave Preload off until you are sure.

Nginx

Inside the HTTPS (listen 443) server block. always makes Nginx send it on error pages too.

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

Apache

Enable mod_headers (a2enmod headers) and add this to the :443 virtual host:

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

WordPress

Best set at the server or CDN (above). If you can only change PHP, this snippet in a small plugin or your child theme's functions.php covers pages WordPress generates:

add_action('send_headers', function () {
    if (is_ssl()) {
        header('Strict-Transport-Security: max-age=31536000; includeSubDomains');
    }
});

FAQ

What max-age should I use for HSTS?

Start with a short value such as 300 seconds while you confirm everything works over HTTPS, then raise it to 31536000 (one year). SiteShield treats anything below about six months as a warning.

Can HSTS break my website?

Only if part of the domain doesn't work over HTTPS. With includeSubDomains, a subdomain that still needs plain HTTP (an old intranet or mail panel) will stop loading for anyone who has seen the header. Check your subdomains first.

Do I need to submit my site to the HSTS preload list?

No, SiteShield doesn't require preload. Preloading protects even the very first visit, but it's hard to undo, so only do it once HTTPS is solid on every subdomain.

Test your HSTS now

Run all 17 checks on your website and email domain in about 30 seconds. Free, no signup, passive checks only.

Rather not do it yourself? Fix it for me starts at AED 750 (about USD 205 by PayPal), quote agreed first. Monitoring re-scans weekly for AED 99/month or AED 990/year.

Related checks

See all 17 security checks →