How to Create Custom URL for the CDN without the Enterprise Version
Unfortunately, custom CDN domains (using your own domain instead of cdn.sanity.io for image URLs) are only available on Enterprise plans. This is mentioned in the community discussion about custom CDN domains.
However, there's a solid workaround that several people in the community use successfully - you can set up a reverse proxy/redirect on your own domain:
The redirect approach:
- Get your asset URL from Sanity
- Extract the filename:
const fileName = url.substring(url.lastIndexOf('/') + 1) - In your links, use your custom domain:
https://your-domain.com/files/${fileName} - Set up a redirect rule on your server/hosting that forwards
/files/*tohttps://cdn.sanity.io/files/[your-project-id]/[your-dataset-name]/:splat
If you're using Netlify, this is particularly straightforward with their redirect rules. Many folks have implemented this successfully.
For images specifically, you can also use the baseUrl option in @sanity/image-url to customize the base URL for your image transformations, though you'd still need the proxy/redirect setup to make it work.
This approach gives you branded URLs for SEO purposes while still leveraging Sanity's global CDN infrastructure for actual delivery. The redirect happens at the DNS/server level, so it's fast and transparent to end users.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.