Connecting RunCache to the Cloudflare Automatic Platform Optimization (APO) allows Cloudflare to store and deliver your complete WordPress pages directly from its worldwide edge network. This speeds up content delivery and significantly reduces origin server load.
Because Cloudflare Page Cache and Cloudflare APO are mutually exclusive, enabling APO automatically disables the Page Cache provider.
Enabling Cloudflare APO takes about 20 minutes.
Before You Start
Before configuring APO in RunCache, ensure you have the following requirements ready:
- An Active APO Subscription: Your domain must have an active APO subscription in your Cloudflare account. For more information on setting up a subscription, visit the Cloudflare APO Getting Started Guide.
- Proxied DNS Records: The DNS record for your WordPress site must be proxied through Cloudflare with the orange cloud icon enabled. If your DNS records are unproxied (grey cloud), review Cloudflare’s proxy status guide to learn how to update them.
- Administrator Access: You need an administrator account for your WordPress dashboard.
- Cloudflare API Access: You need permission to create API tokens within your Cloudflare profile.
Step 1: Create a Cloudflare API Token
Cloudflare provides a dedicated WordPress template that includes all permissions required for APO.
To generate your token in Cloudflare:
- Log in to your Cloudflare dashboard and navigate to My Profile > API Tokens.

- Click Create Token, locate the “WordPress” template in the list, and then click Use template.
- Scroll down to the “Zone Resources” section and change the first dropdown menu from “All zones” to “Specific zone”.
- Select the zone that contains your website domain in the second dropdown menu.

- Scroll to the bottom and click Continue to summary.
- Review the settings on this page and click Create Token.
- Copy your token immediately and save it in a safe place. Cloudflare will not display this value again.
Cloudflare’s WordPress template automatically includes read permissions for analytics, DNS, zone settings, and account settings, as well as write permissions for zone settings and cache purges. You can learn more about these templates in Cloudflare’s token creation guide.
If you prefer to construct a token manually, consult our guide comparing Cloudflare Page Cache with APO to see the exact API endpoints RunCache requires.
Step 2: Configure Cloudflare APO in RunCache
Once you have generated your API token, add your credentials to RunCache:
- Log in to your WordPress dashboard and navigate to RunCache.
- Click the CDN Edge Cache tab, locate the “Cloudflare APO” card, and toggle the switch to the On position to reveal the configuration fields.

- In the “Authentication Method” field, select “API Token (recommended)”.
- Paste your generated token into the “API Token” field.
- Click Save Changes. RunCache will verify your API key and save your changes.
Troubleshooting Errors
RunCache validates your site configuration before saving your credentials. If your setup does not meet Cloudflare’s technical requirements, RunCache does not save, and displays one of two error messages:
1. Subscription Error
Cloudflare APO is not available or not editable for this zone. Please make sure the APO subscription is active in the Cloudflare dashboard.
This error indicates that the domain lacks an active APO subscription or your API token does not have permission to modify zone settings. Open your Cloudflare dashboard and verify that the APO subscription is paid and active for this specific domain.
2. DNS Proxy Error
Cloudflare APO requires the site domain to be proxied through Cloudflare. Please enable the orange cloud for the DNS record in the Cloudflare dashboard.
This error means your domain’s DNS record is currently set to “DNS only” (gray cloud). Open the DNS > Records page in your Cloudflare dashboard and click the cloud icon next to your site’s record to set it to “Proxied” (orange cloud).
Once you resolve these issues in Cloudflare, return to WordPress and click Save Changes again.
How to Test and Verify Your Edge Cache
You can verify that the connection works properly using tools inside WordPress and your command terminal.
Verify the Connection in WordPress
After saving your settings, click Verify Edge Cache. RunCache queries your Cloudflare zone and compares its domain name to your WordPress address.

Test Response Headers in the Terminal
Unlike origin caches or the standard Page Cache provider, APO does not emit X-RunCache-Status or X-RunCache-Type headers from the edge. Instead, APO sends a single cf-edge-cache header.
Open your terminal and run the following command, replacing https://example.com/ with your URL:
curl -s -o /dev/null -D - https://example.com/ | grep -i cf-edge-cacheExpected Responses
- Cached and Working:
cf-edge-cache: cache,platform=wordpressThis indicates that the request is eligible for caching and managed by the WordPress APO platform.
- Bypassed:
cf-edge-cache: no-cacheThis indicates that RunCache evaluated the request and flagged it as uncacheable (e.g., an administrative request or a shopping cart page).
- Inactive (No Output): If the command returns no output, the provider is not active for the request.
If an additional cache key is enabled in your settings, RunCache also appends a Vary header to eligible responses. Learn more in our guide on configuring the cache key setting for Vary headers.
Cache Purging
RunCache automatically purges content using the Cloudflare Automatic Platform Optimization API.
- Full Purges: Clear all edge cache files across your zone.
- Selective Purges: Clear individual posts, pages, or URLs when updated. RunCache splits selective purges into chunks of 30 URLs per API call.
If you need to change this batch size, you can customize the runcache_cloudflare_apo_purge_chunk_size filter in your code. This filter functions independently from the standard Cloudflare Page Cache purge filter.