RunCache provides a fast, simple way to deliver your static assets through a Content Delivery Network (CDN) of your choice. While RunCache includes direct integration with BunnyCDN, you can also connect any CDN provider that supports pull zones, such as Cloudflare, KeyCDN, Fastly, CloudFront, or StackPath, using a custom CDN hostname.

This guide walks you through the process of configuring your custom CDN hostname in the RunCache WordPress plugin, explaining how URL rewriting works, how to choose asset file types, and how to verify that your setup serves files properly.

Overview and Prerequisites

The Custom CDN feature rewrites static asset URLs (such as images, CSS stylesheets, and JavaScript files) across your WordPress site so that visitors download them directly from your CDN provider.

Before configuring this setting in RunCache, ensure you meet the following requirements:

  • Administrator Access: You need an administrator account on your WordPress website.
  • Configured CDN Pull Zone: You must have an active CDN zone created with your chosen provider. Your CDN pull zone must point to your WordPress site as its origin server so it can fetch your static assets automatically.
  • Working CDN Hostname: You need the fully qualified hostname assigned by your CDN provider (for example, cdn.example.com or example.b-cdn.net), with valid SSL configured if your site uses HTTPS.

NOTE: Unlike integrated CDN providers, a custom CDN does not require an API key. RunCache rewrites asset URLs locally without connecting to your CDN provider’s account. This means RunCache cannot automatically purge files from your external CDN cache. If you update an asset, use your CDN provider’s dashboard to clear its cache.

Step 1: Access the Assets CDN Settings in RunCache

To configure your custom CDN hostname, open your WordPress administration panel.

  1. In your WordPress dashboard, navigate to RunCache > Dashboard.
  2. Click the Assets CDN tab at the top of the RunCache settings page.
Custom CDN in Runcache
  1. Toggle the switch next to Custom CDN to the on position. When you enable Custom CDN, RunCache displays two configuration fields: CDN Hostname and Allowed Extensions.
CDN hostname

Note: RunCache allows only one active CDN provider at a time. Enabling the Custom CDN toggle automatically deactivates BunnyCDN or any other active CDN provider in RunCache.

Step 2: Enter Your CDN Hostname

The CDN Hostname field defines the domain name that RunCache uses when rewriting your static asset URLs.

  1. Obtain the hostname value from your CDN provider. The exact steps differ from one provider to another, so refer to your provider’s documentation.
  2. After getting your hostname value, click the input field under “CDN Hostname” and enter your custom CDN hostname (for example, cdn.example.com).
CDN hostname

To ensure reliable URL rewriting, keep the following formatting guidelines in mind:

  • Do not include protocol prefixes: Do not enter http:// or https://. Enter only the bare domain name, such as cdn.example.com.
  • Do not include trailing slashes or subpaths: Do not enter cdn.example.com/ or cdn.example.com/assets. RunCache requires a hostname, not a URL path.
  • Validity checks: If you enter an invalid hostname format or a value containing path segments, RunCache disables URL rewriting silently to protect your site from broken links.

Step 3: Configure Allowed Asset Extensions (optional)

RunCache lets you specify which file types to rewrite to your CDN hostname using the Allowed Extensions field.

  1. Review the input box labeled “Allowed Extensions”.
  2. If you are not sure what to configure here, you can use the recommended defaults. RunCache will rewrite all standard static file types, including images, stylesheets, scripts, web fonts, and common media formats.
  3. To customize the list, enter your desired file extensions separated by commas or spaces (for example: jpg, jpeg, png, gif, webp, svg, css, js, woff2).

Step 4: Save and Verify Settings

Once you enter your hostname and extension preferences, apply your changes:

  1. Click Save Settings in the RunCache Assets CDN card.
  2. Saving your settings activates the Custom CDN provider and enables URL rewriting on your site.

When RunCache displays a status of “Enabled and Working”, it confirms that a valid, unique hostname format is stored in WordPress. It does not ping or test your external CDN service. You must verify external CDN connectivity yourself, as described in the next step.

Step 5: Confirm That Your CDN Serves Assets

After enabling the feature, verify that visitors receive static assets through your CDN.

Method 1: Inspect Your Front-End Page Source

  1. Open your website in a new browser window or an Incognito/Private window.
  2. Right-click anywhere on the page and select View Page Source (or press Ctrl + U on Windows / Cmd + Option + U on Mac).
  3. Search for your CDN hostname by pressing Ctrl + F (or Cmd + F) and typing cdn.example.com.
  4. Verify that links to images (wp-content/uploads/...), stylesheets (.css), and scripts (.js) now begin with your CDN hostname instead of your origin domain.
view source images

Method 2: Test HTTP Headers via Terminal

To confirm that your CDN zone successfully fetches assets from your origin server and delivers them with correct headers, run a quick curl test in your terminal:

curl -k -s -o /dev/null -D - https://cdn.example.com/wp-content/uploads/2026/06/example.jpg

(Replace https://cdn.example.com/.../example.jpg with an actual rewritten image URL from your site).

Review the first few lines of the terminal output:

  • HTTP/2 200 OK (or HTTP/1.1 200 OK): Your CDN is successfully delivering files from your server.
  • Content-Type header: Confirm that the header matches the asset type (for example, image/jpeg or text/css).
cache headers

Troubleshooting Common Response Errors

If curl returns an error status code, check the following common causes:

  • 403 Forbidden: Your CDN pull zone cannot access your origin server. Check if your web server firewall, security plugins, or Cloudflare Bot Management settings are blocking requests from your CDN’s edge IP addresses.
  • 404 Not Found: Your CDN pull zone origin URL is misconfigured, or the requested file path does not exist on your origin server. Verify that your pull zone points to your exact root domain without extra subdirectories.
  • SSL/TLS Handshake Failure: Your CDN hostname lacks an active SSL certificate. Make sure your CDN provider has issued a valid SSL certificate for your custom hostname before forcing HTTPS delivery.

Clearing External CDN Caches

Because RunCache does not connect to external CDN APIs for custom hostnames, it cannot trigger cache purges on your third-party CDN when you edit CSS, JavaScript, or image files. Whenever you update existing static files:

  1. Rely on WordPress version query strings (for example, style.css?ver=1.2.3), which RunCache preserves through the URL rewriting process to invalidate browser caches automatically.
  2. If you overwrite files with identical filenames, log in to your CDN provider dashboard and run a purge action directly on that file path or zone.

Frequently Asked Questions

Does RunCache rewrite all URLs or only static asset URLs?

RunCache rewrites only static asset URLs matching your allowed extensions. It does not rewrite internal page links, blog post URLs, admin dashboard links, or API endpoints.

What happens if I enter an invalid CDN hostname?

If the hostname fails format validation or contains invalid characters, RunCache automatically disables asset URL rewriting to keep your website functioning normally and prevent broken links.

Can I use Cloudflare with Custom CDN in RunCache?

Yes, you can configure a proxied Cloudflare subdomain as your custom CDN hostname in RunCache. However, if you want to use Cloudflare as your CDN, we recommend following our Cloudflare APO guide instead. It is specifically built for WordPress on Cloudflare to deliver optimal performance.