CDN Settings
Serve offloaded media through CloudFront, Cloudflare, Bunny, Fastly or another CDN, and invalidate caches when files change.
If you are not using Imgix, a CDN in front of your storage bucket reduces latency and can reduce egress costs. Media Cloud only needs the CDN’s base URL; the CDN itself is configured with your provider.
CDN Base URL
This is the base URL Media Cloud uses when rewriting image and media URLs. It replaces the storage host, for example:
https://cdn.example.com
Do not include a trailing path unless your CDN serves the bucket from one.
Document CDN Base URL
Use this if non-image files should come from a different CDN or hostname. If left blank, document URLs use the image CDN or the storage URL.
Imgix
When Imgix is enabled, the CDN Base URL is ignored for images; Imgix serves them. The Document CDN Base URL is still used for non-image files.
Common CDN setups
The exact steps depend on the CDN. In general:
- Create a distribution or pull zone with your storage bucket as the origin.
- Restrict origin access so the bucket is only readable through the CDN, if your provider supports it.
- Add a custom domain and enable HTTPS.
- Put the custom domain in CDN Base URL.
- Purge the CDN after changing files or Media Cloud settings.
Amazon CloudFront
Use the S3 bucket as the origin. Restrict bucket access with an origin access identity or origin access control, and forward the Host header only if your setup requires it. The distribution domain or custom domain goes in CDN Base URL.
Cloudflare
Create a CNAME or custom domain that proxies to the bucket’s public hostname. Keep the proxy enabled and use the custom domain in CDN Base URL. Cloudflare’s cache rules determine how long media is cached.
Bunny CDN
Create a pull zone whose origin is the storage bucket or storage zone. Use the pull zone hostname in CDN Base URL. If the storage provider is Bunny CDN, the pull zone URL is already part of the provider settings.
Fastly
Configure the bucket as the origin and set the CDN hostname in CDN Base URL.
Cache invalidation
When you replace an image or change storage settings, the CDN may keep serving the old file. Invalidate the affected URLs or purge the whole cache.
- CloudFront: create an invalidation for the changed paths.
- Cloudflare: purge by URL or purge everything.
- Bunny: purge the pull zone cache.
- Fastly: purge by URL or surrogate key.
- Imgix: use Imgix’s cache controls.
If a new file keeps its old content, check the storage URL directly first. If the storage URL is correct but the CDN URL is stale, the problem is the CDN cache.
HTTPS and mixed content
Use an HTTPS CDN URL on an HTTPS site. An HTTP CDN URL causes mixed-content warnings and may be blocked by the browser.
Troubleshooting
| Problem | Likely cause |
|---|---|
| URLs still use the storage host | CDN Base URL is empty or the CDN is disabled. |
| Images load from Imgix, not the CDN | Imgix is enabled; the image CDN setting is ignored by design. |
| CDN returns 403 | Origin access is misconfigured, or the bucket is private and the CDN is not authorized. |
| CDN returns 404 | The origin path or bucket mapping is wrong. |
| Old images keep appearing | The CDN cache was not purged. |
| Mixed-content warnings | The CDN URL is HTTP on an HTTPS site. |
Need a hand with this guide?
Send support the exact step you’re stuck on and we’ll help you finish the setup.