Docs

Cloudflare CDN

3 min readUpdated November 9, 2026

This page explains how to serve your media through Cloudflare’s network. WP Media Cloud has no Cloudflare CDN option and no Cloudflare API connection. You use a domain that Cloudflare proxies and enter it as a Custom CDN.

Which setup applies to you#

Your storage providerWhat to do
Cloudflare R2Connect a custom domain to the bucket in Cloudflare and enter it as the R2 CDN / Public URL. See Cloudflare R2.
Amazon S3, Google Cloud Storage, DigitalOcean Spaces, Wasabi, Hetzner, Backblaze B2 or an S3-compatible endpointProxy a subdomain through Cloudflare to the bucket, then choose Custom CDN. Follow the steps below.
Bunny Edge StorageNot supported. Bunny Edge Storage has no CDN choice and uses its own pull zone.

How it works#

Cloudflare sits between your visitors and the bucket. The first request for a file goes to the bucket, and Cloudflare caches the answer. Later requests are served from Cloudflare’s cache.

WP Media Cloud only needs the address. It writes that address into media URLs. It does not talk to Cloudflare, so the Dashboard shows no Cloudflare bandwidth.

Step 1: Set up the proxied domain in Cloudflare#

  1. Pick a subdomain on a domain that uses Cloudflare, for example media.example.com.
  2. Point it at your bucket’s public address with a proxied DNS record.
  3. Make sure the bucket accepts requests for that hostname. Many providers expect their own hostname or a bucket named after your domain. Cloudflare Origin Rules can rewrite the Host header if needed.
  4. Open a file at https://media.example.com/ followed by its path in the bucket. It should load.

The file path stays the same as in the bucket. For example, 2026/10/photo.jpg becomes https://media.example.com/2026/10/photo.jpg.

Use the SSL/TLS mode Full or Full (strict) in Cloudflare so the connection to the bucket uses HTTPS.

Step 2: Enter the domain in WP Media Cloud#

Setup wizard CDN choice with a custom CDN URL

In the setup wizard:

  1. Go to Media Cloud. On a new site the wizard opens by itself. Otherwise go to Settings and click run the setup wizard.
  2. Pick your storage provider and fill in its fields.
  3. Under CDN Configuration, choose Custom CDN.
  4. Enter https://media.example.com in CDN URL.
  5. Click Continue, then Save & Go to Dashboard.

In Settings:

  1. Go to Media Cloud > Settings and find your provider’s CDN card, for example Wasabi CDN.
  2. Choose Custom CDN and enter the address in CDN URL.
  3. Click Save Settings, then Update all media URLs under Apply to Existing Media.

Amazon S3 has no CDN card in Settings. Run the setup wizard again to change it. You can also use constants, see Custom CDN URL.

Cache purging#

CDN card in Settings with a custom CDN URL

WP Media Cloud uploads every file with a one-year Cache-Control header. When a file is re-uploaded under the same name, for example after an image optimizer compresses it, Cloudflare and browsers may keep the earlier copy.

To purge one file, open your domain in the Cloudflare dashboard and go to Caching > Configuration. Under Purge Cache, choose Custom Purge, purge by URL and enter the file’s address. See Purge by single-file.

Troubleshooting#

What you seeWhat it meansHow to fix it
Images still load from the bucket addressCDN URL is empty or was not saved.Enter the address under Custom CDN, save, and clear your page cache.
Files return 404 or an error through CloudflareCloudflare does not reach the bucket with a hostname the bucket accepts.Test the bucket’s own address first. Then check the DNS record and any Origin Rule.
A cached 404 or an old version appearsCloudflare is serving its cached copy.Purge the URL in Cloudflare.
Mixed content warningsThe connection to the bucket uses HTTP.Set Cloudflare SSL/TLS to Full or Full (strict), and use https:// in CDN URL.
CDN Bandwidth on the Dashboard shows 0 BWP Media Cloud does not read Cloudflare statistics.Check traffic in the Cloudflare dashboard.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only