Cloudflare Page Cache allows Cloudflare to store and deliver copies of your web pages directly from its global network of edge servers. This means most of your visitors receive responses from the data center closest to them rather than waiting for your origin server on RunCloud to process the request.

This integration is built directly into the RunCache WordPress plugin. It works on every Cloudflare plan, including the Free plan, and takes about ten minutes to configure.

Prerequisites

Before starting, ensure that you have the following items ready:

  • Your website domain is already added to your Cloudflare account.
  • Your DNS records in Cloudflare are set to proxied status (indicated by an orange cloud icon). You can learn more in Cloudflare’s guide to proxy status.
orange proxy
  • Access to create an API token inside your Cloudflare account.
  • Administrator access to your WordPress dashboard.

Step 1: Create a Cloudflare API Token

RunCache needs permission to manage cache rules and purge cached pages on Cloudflare. For security, we recommend using a scoped API token instead of your Global API Key.

  1. Log in to your Cloudflare dashboard and navigate to My Profile > API Tokens.
  2. Click Create Token. On the next page, locate the “Custom token” option and click Get started.
Create API token in Cloudflare
  1. Type a descriptive name for your token, such as RunCache Edge Cache.
  2. Under the “Permissions” section, use the drop-down menus to add the following three permissions:
    • “Zone” — “Zone” — “Read”
    • “Zone” — “Cache Purge” — “Purge”
    • “Zone” — “Cache Rules” — “Edit”
  3. Under “Zone Resources”, choose “Include”, select “Specific zone”, and pick your website’s domain name from the drop-down list.
Cache rules
  1. Scroll to the bottom and click Continue to summary.
  2. Review your settings and click Create Token.
  3. Copy your generated token immediately and store it in a safe place. Cloudflare will not display this value again.
Cloudflare API token

For additional details on token security, refer to Cloudflare’s documentation on creating API tokens.

Step 2: Enable Cloudflare Page Cache in WordPress

Once you have your API token, connect RunCache to your Cloudflare account from your WordPress admin dashboard.

  1. Log in to your WordPress dashboard as an administrator and navigate to RunCache.
  2. Click the CDN Edge Cache tab.
  3. Toggle the switch next to “Cloudflare Page Cache” to the on position.
CDN cache RunCache
  1. In the “Authentication Method” field, select “API Token”.
  2. Paste your copied token into the “API Token” field.
  3. Click Save Changes.
RunCache enable Edge caching

After saving your settings, you can confirm that the integration is functioning correctly by checking the chip in the right corner of the screen.

Cache enabled

Checking HTTP Response Headers

You can also verify that caching is active by checking the HTTP headers returned by your site using your browser’s developer tools or by running a command in your terminal:

curl -s -o /dev/null -D - https://example.com/ | grep -i -e x-runcache -e cdn-cache-control

When your page is cacheable, RunCache and Cloudflare will return headers similar to these:

CDN cache headers
  • The X-RunCache-Status: HIT header indicates that the RunCache plugin on your server generated the page as cacheable content.
  • The CDN-Cache-Control header instructs Cloudflare to hold the page at the edge for 3600 seconds.
  • Visitors who are logged into WordPress or have items in a WooCommerce shopping cart will see X-RunCache-Status: BYPASS instead, ensuring that private dynamic content is never stored in a shared cache. You can review what is never cached to learn more about default exclusion behaviors.
  • To check whether Cloudflare served the response from edge memory, review the cf-cache-status header added by Cloudflare as described in Cloudflare’s cache control documentation.

Cache Purging

RunCache keeps your Cloudflare edge cache synchronized with your site changes automatically:

  • Full Purge: When you clear the entire cache in WordPress, RunCache instructs Cloudflare to purge everything stored for the zone.
  • Post Updates: When you edit or publish a post, RunCache sends a selective purge request to Cloudflare containing only the modified URLs, processed in batches of 30 URLs at a time.
  • Single URL Purge: Specific URLs are evicted immediately upon request.

To customize how many URLs are purged in each batch, you can use the runcache_cloudflare_purge_chunk_size filter documented in the RunCache filter reference. For more information on verifying purges, read clearing the Cloudflare cache from WordPress and Cloudflare’s purge documentation.

Custom Cache Keys

If you specify custom headers under RunCache > Rules, RunCache will attempt to register those headers into your Cloudflare cache key.

Cloudflare only supports custom header cache keys on Enterprise plans. If your site is on a Free, Pro, or Business plan, Cloudflare will reject that section of the rule. In this event, RunCache logs a warning and automatically reinstalls the cache rule without the custom header component, ensuring that your edge caching continues to operate smoothly. You can read more about this requirement in Cloudflare’s cache key guide.

Disabling Cloudflare Edge Caching

If you decide to turn off Cloudflare edge caching:

  1. Navigate to RunCache > Dashboard > CDN Edge Cache.
  2. Toggle the “Cloudflare Page Cache” switch to the off position.
disable cache

The plugin performs this same cleanup if you deactivate or uninstall RunCache from your WordPress site.