CDN – Cloudflare Setup

Cloudflare CDN Integration

Cloudflare sits in front of your origin server and caches pages at hundreds of edge locations worldwide. When Cyclone Static regenerates a cached page, it automatically purges that URL from Cloudflare’s edge cache so visitors receive the updated content immediately.

What You Need

  • A Cloudflare account with your domain added as an active zone
  • A Cloudflare API Token with Cache Purge permission for your zone
  • Your Zone ID

Step 1: Create an API Token

Cyclone Static uses a scoped API Token (not your Global API Key). Tokens can be limited to exactly the permissions needed — cache purging only — which is more secure than using a global key.

  1. Log in to the Cloudflare dashboard and go to My Profile → API Tokens.
  2. Click Create Token.
  3. Click Use Template next to Cache Purge. This creates a token with only the permissions Cyclone needs.
  4. Under Zone Resources, select Include → Specific zone and choose your domain.
  5. Click Continue to Summary, then Create Token.
  6. Copy the token value shown. This is the only time Cloudflare shows it — save it now.

Step 2: Get Your Zone ID

  1. In the Cloudflare dashboard, click on your domain.
  2. On the Overview page, scroll down in the right sidebar until you see the API section.
  3. Copy the Zone ID — a 32-character hexadecimal string.

Step 3: Configure Cyclone Static

  1. Go to Cyclone Static → Settings.
  2. Under CDN Integration, set the provider dropdown to Cloudflare.
  3. Paste your API Token in the API Token field.
  4. Paste your Zone ID in the Zone ID field.
  5. Click Verify Connection. Cyclone will call the Cloudflare API to confirm the token is valid and the zone is accessible.
  6. Click Save Settings.

How Purging Works

When Cyclone regenerates a static file, it calls the Cloudflare API to purge that specific URL from the edge cache. Only the changed URL is purged — your other cached assets remain warm.

When you click Clear All Cache on the Dashboard, Cyclone sends a Purge Everything request for your zone, clearing all cached content across all Cloudflare edge nodes.

Cloudflare Cache Rules and Page Rules

By default, Cloudflare’s free plan caches static assets (images, CSS, JS) but not HTML pages. To get full benefit from Cyclone Static + Cloudflare, you need to tell Cloudflare to cache HTML as well.

Using Cache Rules (recommended for Pro plans and above):

  1. Go to Caching → Cache Rules in the Cloudflare dashboard.
  2. Create a rule that matches your site’s hostname.
  3. Set Cache Status to Cache Everything.
  4. Add a bypass condition: if the request has a cookie matching wordpress_logged_in_.*, set Cache Status to Bypass.

Using Page Rules (legacy, available on free plans):

  1. Go to Rules → Page Rules.
  2. Create a rule matching yourdomain.com/*.
  3. Set the setting to Cache Level: Cache Everything.

Without one of these rules, Cloudflare will not cache your HTML pages regardless of Cyclone’s configuration — CDN purges will still work, but there’s nothing in the Cloudflare cache to purge.

Cloudflare and Already-Static Files

Cyclone Static serves static HTML files directly from Apache before PHP starts. Cloudflare can then cache those already-served files at the edge. This creates two layers of caching:

  1. Origin layer: Apache serves from Cyclone’s static HTML files (no PHP, no database)
  2. CDN layer: Cloudflare caches those responses at edge locations globally

Visitors close to an edge node get the edge-cached response (often sub-5ms). Visitors in regions with no nearby edge node get the Apache-direct response, which is still extremely fast because there’s no PHP overhead.

Troubleshooting

Token verification fails with “insufficient permissions”: The token must have the Zone → Cache Purge → Purge permission. If you created the token from the Cache Purge template, this is included automatically. Double-check by viewing the token’s permissions in My Profile → API Tokens.

Cloudflare is serving stale content after a publish: Confirm Cyclone is regenerating the file (check the HTML comment in source view). If the file is regenerated but Cloudflare still serves old content, check the Cloudflare audit log under Account → Audit Log to see if purge API calls are arriving. If they’re not arriving, confirm your API token and Zone ID are correct.

Cloudflare is not caching HTML at all: This is the most common Cloudflare + WordPress issue. Make sure you’ve created a Cache Rule or Page Rule to cache HTML as described above.

Logged-in users seeing cached pages: Cloudflare should bypass the cache for logged-in WordPress users. Verify your Cache Rule or Page Rule includes a cookie bypass condition for wordpress_logged_in_. Alternatively, Cloudflare’s free plan may not support cookie-based bypass — in that case, consider adding your admin IP to a firewall rule that bypasses the CDN.