Appearance
Cloudflare
If your site is behind Cloudflare, Speedy can let Cloudflare keep your pages too, at its edge close to visitors, and clear them when content changes.
Speedy detects Cloudflare from its CF-Ray header and says so in Settings → Plugins → Speedy Cache and on the utility page.
Without a token
Speedy still works: pages are cached on your server. Speedy tells Cloudflare not to keep HTML pages (Cache-Control: no-cache, s-maxage=0), so Cloudflare never shows a page Speedy can’t clear. Images, CSS and JavaScript are cached by Cloudflare as usual.
With a token
- In Cloudflare, go to My Profile → API Tokens → Create Token → Create Custom Token.
- Give it one permission: Zone → Cache Purge → Purge.
- Under Zone Resources, choose Include → Specific zone → your domain.
- Copy the token. Then copy the Zone ID from the domain’s Overview page.
- Add both to
.env:bashCLOUDFLARE_TOKEN="…" CLOUDFLARE_ZONE_ID="…" - In Settings → Plugins → Speedy Cache, enter
$CLOUDFLARE_TOKENand$CLOUDFLARE_ZONE_ID, and save. - On the utility page, click Test Cloudflare.
Cached pages are now sent with Cache-Control: public, s-maxage=31536000, max-age=0: Cloudflare keeps them, browsers check back each time, and Speedy clears Cloudflare whenever a page changes.
Make Cloudflare keep HTML
By default, Cloudflare only caches files like images. To cache pages, add a Cache Rule for your domain: Eligible for cache, and Edge TTL → Use cache-control header if present. Exclude /admin* and /actions*, and add Bypass cache when the Cookie header contains _identity, _commerce_cart or speedy_state, so logged-in visitors, carts and multi-step forms get their own pages.
How clearing works
- Changed pages are cleared by URL, 30 at a time.
- Clear all pages clears everything in Cloudflare too.
- Results show on the utility page, and failures in the log.