---
title: "Cloudflare"
url: "https://dudlewebs.com/guideline/media-cloud-sync/cdn-setup/cloudflare/"
markdown_url: "https://dudlewebs.com/guideline/media-cloud-sync/cdn-setup/cloudflare.md"
type: "Docs"
language: "en-US"
date_published: "2026-11-08T11:04:20+00:00"
date_modified: "2026-11-09T17:03:09+00:00"
---

# Cloudflare

How you use Cloudflare depends on where your media is stored. Your domain must be on Cloudflare in both cases.

> Cloudflare changes its dashboard from time to time. If a screen looks different, follow the linked Cloudflare guide for that step.

## With Cloudflare R2 storage

This is the simplest setup.

1. Open your bucket in the Cloudflare dashboard and go to **Settings → Custom Domains → Connect Domain**.
2. Enter a subdomain such as `media.example.com`. Cloudflare adds the DNS record for you.
3. In Media Cloud Sync, go to **Settings** and click **Change** on the **Delivery** card.
4. Choose **Cloudflare R2**, enter the domain under **Use Custom Domain Name (CNAME)**, and click **Save**.
5. Click **Recheck** on the **Delivery** card.

A custom domain goes through Cloudflare’s cache. The `r2.dev` address doesn’t, so it has no cache to purge. See Cloudflare’s [public buckets guide](https://developers.cloudflare.com/r2/buckets/public-buckets/) and [R2 cache guide](https://developers.cloudflare.com/cache/interaction-cloudflare-products/r2/).

Note that by default Cloudflare only caches certain file types. Set up a Cache Rule if you want every file cached.

## With other storage

To put Cloudflare in front of a bucket such as Amazon S3:

1. Create a proxied DNS record for your subdomain, such as `media.example.com`, pointing to your bucket’s address.
2. Requests must reach the right bucket, because storage providers use the host name to find it. Cloudflare recommends [Cloud Connector](https://developers.cloudflare.com/rules/cloud-connector/providers/) for object storage. On Amazon S3, the alternative is a bucket named the same as your subdomain. See Cloudflare’s [notes on S3 DNS records](https://developers.cloudflare.com/dns/manage-dns-records/reference/vendor-specific-records/).
3. In Media Cloud Sync, go to **Settings** and click **Change** on the **Delivery** card.
4. Choose **Cloudflare CDN**, enter the domain under **Use Custom Domain Name (CNAME)**, and click **Save**.
5. Click **Recheck** on the **Delivery** card.

> Under Cloudflare’s Full (Strict) SSL mode, bucket names can’t contain dots.

## Clear stale files (optional) `PRO`

Connect [CDN Cache Purge](https://dudlewebs.com/guideline/media-cloud-sync/pro-tools/cdn-cache-purge/) with your **Zone ID** and an **API token** with the Zone → Cache Purge permission. This matters on Cloudflare, where a deleted or replaced file can stay available until its cached copy is purged or expires.

> **Warning:** On most Cloudflare plans, **Purge everything** clears the whole zone, including your site’s own cached pages.

## Private Media

Private Media `PRO` isn’t available with Cloudflare CDN or Cloudflare R2.

## Related

- [Quick Start: Cloudflare R2](https://dudlewebs.com/guideline/media-cloud-sync/storage-providers/quick-start-cloudflare-r2/)
- [Delivery Settings and CDN](https://dudlewebs.com/guideline/media-cloud-sync/settings/delivery-settings-and-cdn/)

[← Previous Bunny.net](https://dudlewebs.com/guideline/media-cloud-sync/cdn-setup/bunny-net/) [Next → Fastly](https://dudlewebs.com/guideline/media-cloud-sync/cdn-setup/fastly/)

Still need help?

[Chat with us Quick questions, answered live](https://dudlewebs.com/contact/) [Contact us Sales, partnerships or anything else](https://dudlewebs.com/contact/) [Create a ticket Technical issues with your site](https://dudlewebs.com/submit-ticket/)
