Cloudflare Support (Reverse Proxy Purging)
Last updated
Was this helpful?
Last updated
Was this helpful?
Helping to configure Cloudflare is not included as part of Speedy's support. Below are some tips on how to configure it, and there are a lot of online resources. We can offer additional support if needed.
If you encounter any issues with Speedy itself regarding this feature please be as detailed as possible, including screenshots, template tags, and header responses when creating a ticket.
Speedy supports reverse proxy cache purging with Cloudflare out of the box. If a purger is enabled you will see a new Purge All option at the top of Speedy's control panel page.
If you’re unfamiliar with Cloudflare, you might wonder why it’s needed if you're already using Speedy. The answer is simple: Cloudflare (and similar services) uses a global network of data centers to serve your site’s content (HTML, CSS, JavaScript, and other static assets) from locations closer to your users.
No matter how optimized your local caching is, nothing beats the performance of delivering content directly from the edge. This reduces latency, lowers the load on your servers, and enhances the overall user experience.
Beyond performance, Cloudflare provides valuable security features, including DDoS protection and a Web Application Firewall (WAF) for blocking malicious bots, applying rate limits, and strengthening your site’s defenses.
Best of all Cloudflare provides most of these features for free, and it's pretty easy to setup.
You will need an API Key and Zone ID from your Cloudflare account. The Zone ID is located right on your site's Overview page in the right column near the bottom. Note the Account ID is not the API token. You will need to create an API token. It's easy:
Scroll down to Create Custom Token, then click Get Started.
You will be presented with a form to configure the tokens permissions. You only need to give it Cache Purge > Purge, then set it to your zone. The form should look similar to this before saving.
You will probably need to configure a few Page Rules. Ignore all ?ACT
requests since those are usually Ajax requests or other internal requests that you do not want to cache. Based on your sites needs, you can add other rules here.
To test your settings you can run the following curl command to check the response headers.
If after setting up the Page Rules to Cache Everything, and you're still seeing "BYPASS" as the cf-cache-status
value, then its likely the ExpressionEngine cookies are causing Cloudflare to not cache the page. You'll need to turn off the tracker
cookie in the ExpressionEngine CP: Settings > Content & Design > Tracking - Disable all cookies, especially exp_tracker.
After the cookies are disabled, you should start seeing a "HIT" response.
Other possible cf-cache-status
values.
HIT → Cached successfully.
MISS → Not cached (Cloudflare had to fetch it from your origin).
EXPIRED → Cached version expired and was refreshed.
BYPASS → Caching bypassed (e.g., certain rules or cookies).
When configuring a reverse proxy purger in Speedy you will need to set the Cache Control option. You'll likely want to use Partial or Full.
Default — Uses ExpressionEngine cache headers and cache nothing.
This sets the Cache-Control header to no-store, no-cache, must-revalidate
Partial — Cloudflare & CDNs will cache pages, but browsers will not.
This sets the Cache-Control header to public, max-age=0, s-maxage=N
Full — Browser, Cloudflare & CDNs will cache pages.
This sets the Cache-Control header to public, max-age=N, s-maxage=N, must-revalidate
"N" represents the number of seconds, which will be set based on the TTL value you've set in your Speedy cache tag or global config.
After upgrading or installing you will see a exp_speedy_urls
table added to your database. Since CDN purging is based on the full URL, Speedy will store the URL for every cache key it creates. If you have multiple keys at the same URL, then you might see multiple rows in this table, which is OK. Whenever Speedy clears one of those cache keys, it will also send a purge request for the associated URL to Cloudflare and remove rows from this table.
If you want to use a CDN other than Cloudflare, you can create your own purger and define it in the config.php
file.
It will need to implement the Purger
interface. You can reference the addons/speedy/Service/Purgers/Cloudflare.php
class for an example.
Visit , then click Create Token.