Docs

Custom CDN URL

5 min readUpdated November 9, 2026

The Custom CDN option lets you serve media from any address you choose. Use it for Amazon CloudFront, Fastly, a Cloudflare-proxied domain, your bucket’s own custom domain or your own proxy. This page explains how it works, where to set it and how to change it safely.

When to use it#

  • Your CDN has no named option in WP Media Cloud, such as CloudFront or Fastly.
  • You put Cloudflare in front of a bucket. See Cloudflare CDN.
  • Your bucket has its own custom domain, such as a DigitalOcean Spaces custom domain.
  • You use Bunny.net, KeyCDN, EWWW Easy IO or CDN77 but want to type the address yourself.

The named options add CDN bandwidth to the Dashboard. Custom CDN has no API connection, so it adds no stats.

Which storage providers can use it#

Storage providerHow to set the addressConstant prefix
Amazon S3Custom CDN in the setup wizard. There is no CDN card in Settings.WPMC_AWS_
Google Cloud StorageCustom CDN in the wizard or the Google Cloud Storage CDN cardWPMC_GCS_
DigitalOcean SpacesCustom CDN in the wizard or the DigitalOcean Spaces CDN cardWPMC_DO_
WasabiCustom CDN in the wizard or the Wasabi CDN cardWPMC_WASABI_
Hetzner Object StorageCustom CDN in the wizard or the Hetzner Object Storage CDN cardWPMC_HETZNER_
Backblaze B2Custom CDN in the wizard or the Backblaze B2 CDN cardWPMC_B2_
S3-compatible endpoint (Custom S3)Custom CDN in the wizard or the Custom S3 CDN cardWPMC_S3_
Cloudflare R2No CDN choice. Enter the address in CDN / Public URL on the Cloudflare R2 card.WPMC_R2_CDN_URL only
Bunny Edge StorageNo CDN choice. The address comes from the pull zone.None

Sites set up with the older s3compat provider use the S3-Compatible CDN card and the WPMC_S3COMPAT_ prefix.

How the address is used#

WP Media Cloud builds each media URL from the CDN URL and the file’s path in the bucket. The path is the same as in your uploads folder.

CDN URLFile in the bucketMedia URL
https://media.example.com2026/10/photo.jpghttps://media.example.com/2026/10/photo.jpg
https://cdn.example.com/media2026/10/photo.jpghttps://cdn.example.com/media/2026/10/photo.jpg

A trailing slash in the CDN URL is removed automatically. If the CDN URL is empty, WP Media Cloud uses the bucket’s own public address.

Your CDN must return the file at that path. Point the CDN’s origin at the bucket, so that /2026/10/photo.jpg on the CDN maps to the same object in the bucket.

Set it in the setup wizard#

Setup wizard CDN choice with a custom CDN URL
  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 the address in CDN URL, starting with https://.
  5. Click Continue, then Save & Go to Dashboard.

Set it in Settings#

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

Update all media URLs stores the new address on every offloaded item. It uses the address shown in the card, so save first.

Set it in wp-config.php#

define( 'WPMC_WASABI_CDN_TYPE', 'custom' );
define( 'WPMC_WASABI_CDN_URL',  'https://media.example.com' );

Replace WASABI with your provider’s prefix from the table above. For Cloudflare R2, define only WPMC_R2_CDN_URL. Constants take priority over Settings, and the Health page and Dashboard read them too.

Change the address later#

CDN card in Settings with a custom CDN URL

Pages load images from the CDN URL that is saved now. WP Media Cloud rewrites URLs in your content as each page loads, so most sites only need to save the new address.

  1. If you used URL Replace (beta) to write CDN URLs into your content, revert first. Go to Media Cloud > Migration and find URL Replace. Use Revert selected to local URLs, or Revert to local under Individual Post or Page.
  2. Enter the new address and click Save Settings. On Amazon S3, run the setup wizard instead.
  3. Click Update all media URLs.
  4. If you use URL Replace, run Replace selected with CDN URLs again.
  5. Clear your page cache.

Step 1 must happen before you change the address. URL Replace only finds URLs that match the address saved at that moment.

Go back to the bucket address#

  1. In your provider’s CDN card, choose Direct Bucket.
  2. Click Save Settings.

In WP Media Cloud 1.1.9 or newer, choosing Direct Bucket also clears the CDN URL. On older versions, choose Custom CDN and clear CDN URL first. If WPMC_<PROVIDER>_CDN_URL is defined in wp-config.php, remove it too.

Dashboard stats#

With Custom CDN, WP Media Cloud does not read any CDN statistics. The CDN Bandwidth card shows 0 B and the bandwidth chart stays empty. Check traffic in your CDN’s own dashboard.

Troubleshooting#

What you seeWhat it meansHow to fix it
Images still load from the bucket addressCDN URL is empty, not saved, or a page cache holds old HTML.Check CDN URL, click Save Settings, and clear your page cache.
Images still load from an old CDN addressA constant overrides Settings, or URL Replace saved the old address in your content.Check wp-config.php for WPMC_<PROVIDER>_CDN_URL. Revert and rerun URL Replace as described above.
Files return 404 through the CDNThe CDN does not map paths to the bucket correctly.Open the file at the bucket’s own address first. Then check the CDN’s origin and path settings.
Update all media URLs is greyed outCDN URL is empty.Enter an address first.
The Health page warns about the CDN URL checkThe CDN URL did not respond to a test request.Check the address, DNS and SSL certificate of your CDN.

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