Home/Guides

HSTS Can Reduce Your TTFB (and Speed Up WordPress)

This post first appeared in our newsletter in early 2024 – click here to subscribe and see the original post. Updated October 2026.

Enable Hsts Headers For Better Ttfb

Enabling HSTS is one of the standard steps in our WordPress speed optimization process. It takes a couple of minutes, costs nothing, and it makes your site faster for anyone arriving on an old http:// link, while making sure every visitor gets the fastest protocols your server supports.

HSTS stands for HTTP Strict Transport Security. It’s a response header that tells browsers your site must only ever be loaded over HTTPS. As well as the speed gains, your site becomes more secure, scores higher on security test tools, and in some cases we’ve seen SEO improvements because it helps clear up HTTP vs HTTPS canonical issues.

Membership sites and WooCommerce stores benefit the most, because they handle sensitive customer data and tend to have more repeat visitors, but every site benefits from it.

On this page

How HSTS makes your site faster

1. It removes the HTTP to HTTPS redirect

Without HSTS, a visit that starts on an http:// address (an old bookmark, an older backlink, someone typing your domain) goes like this: the browser connects to your server over plain HTTP, your server replies with a 301 redirect, and only then does the browser start again over HTTPS. That’s a full extra round trip before the first byte of the real page arrives, and on a mobile connection or a visitor on the other side of the world it can easily add a few hundred milliseconds to your TTFB.

With HSTS, the browser remembers your rule and rewrites http:// to https:// itself, before anything is sent. In Chrome’s developer tools you’ll see this as a “307 Internal Redirect” that takes close to zero time, because it never leaves the visitor’s device.

2. It guarantees HTTP/2 and HTTP/3

Browsers only speak HTTP/2 and HTTP/3 over HTTPS. HTTP/3 runs on QUIC, which has encryption built in. Over plain HTTP you’re stuck with HTTP/1.1, which downloads files over a handful of connections at a time instead of multiplexing everything over one.

By forcing every request onto HTTPS, HSTS makes sure visitors always get the faster protocols. It’s also the reason we treat HSTS as a speed setting and not only a security one.

3. It helps repeat visitors most

The browser learns the rule on the first HTTPS visit, so the gains show up on repeat visits. That’s exactly the traffic that matters most on stores and membership sites: returning customers, logged-in members and people coming back to buy.

The security and SEO side benefits

  • No unencrypted requests. Because the upgrade happens inside the browser, nothing goes out over plain HTTP, so there’s nothing for anyone on the same public Wi-Fi to intercept or tamper with.
  • Better security scores. Tools like Qualys SSL Labs and Mozilla Observatory check for HSTS, and SSL Labs only awards its A+ grade to sites that send the header. It’s now expected as standard security practice.
  • Cleaner canonicals. Google lists HSTS as one of the ways to tell it the HTTPS version of a page is the one to index. Keep your normal 301 redirect from HTTP to HTTPS in place too, because Googlebot doesn’t remember HSTS rules. We cover the SEO side in more detail in HSTS and SEO.

If you want the full technical background, this Wikipedia article does a good job of explaining how it works.

Before you start: your site must already work on HTTPS with a valid SSL certificate. Don’t enable HSTS on a site without one, because browsers will refuse to load it over HTTP and returning visitors will see an error.

How To Enable HSTS in Cloudflare

If you’re using Cloudflare, HSTS is very easy to enable. Click play on the video below to see a walk through.

  1. In the Cloudflare dashboard, open your domain and go to SSL/TLS, then Edge Certificates.
  2. Find HTTP Strict Transport Security (HSTS) and select Enable HSTS.
  3. Read the warning, select I understand, then Next.
  4. Switch on Enable HSTS (Strict-Transport-Security) and set Max Age Header to 6 months.
  5. Leave Apply HSTS policy to subdomains and Preload off unless every subdomain is on HTTPS and you’re sure you want them, then select Save.
  6. Test your site with the tool below.

Enabling HSTS in your hosting control panel instead

You don’t have to use Cloudflare. Most hosting control panels can add the header for you. In Plesk it’s on the domain’s SSL/TLS Certificates screen, where you switch on HSTS and choose a max age. Other hosts may need a line in the server configuration, or you can ask their support team.

A header set on your server still works if the site sits behind Cloudflare. Cloudflare passes it through to visitors untouched. We checked this on a batch of Cloudflare-proxied sites and the server’s header reached visitors on every one. The exception is if you also switch on HSTS in Cloudflare: Cloudflare’s settings then replace your server’s, so manage it in one place.

How To Check Your HSTS Headers

If you want to check whether HSTS is enabled for your site, use this tool (https://domsignal.com/hsts-test). If your site redirects the bare domain to www (or the other way round), test the address visitors actually land on.

Hsts Test Result Showing The Strict-Transport-Security Header Found

If you’re on one of our hosting and maintenance plans, our team has likely already enabled this for you.

Brendan Tully, Principal Consultant at WPSpeedFix

About Brendan Tully

Hey I’m Brendan, Principal Consultant here at WPSpeedfix!

WPSpeedFix is a WordPress speed optimization and technical SEO agency. We fix slow WordPress and WooCommerce sites, get sites passing Google’s Core Web Vitals and solve the tricky technical problems other developers get stuck on.

Since we started WPSpeedFix in 2016 as an offshoot of our SEO agency we’ve optimized 5000+ websites.

Need Help? Get a FREE Site Audit

Get a free, expert review from the team that’s optimized over 5,000 WordPress & WooCommerce sites. Tell us what you need help with and we’ll tell you what’s wrong, what’s fixable, and give you a clear plan to make it fast.

“I'd absolutely recommend WP Speed Fix to anyone wanting to speed up their Wordpress website. We have struggled for years to get our busy site faster, yet within just a week of Brendan and the team working their magic, our site is now lightning fast. Very professional and quick to respond to emails... these guys know what they're doing. Thanks for all the work.”

Get Your FREE Site Audit

5.0 from 47 reviews on Google