😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Can I Control CORS Settings for the Asset CDN?

5 replies
Last updated: Sep 27, 2022
Hi everyone. Is it possible to control CORS settings for the Asset CDN (not the data API)? I would like to upload GeoJSON files as part of my schema and fetch them from my front-end, but at the moment can’t do so due to crossdomain/CORS restriction. Any advice much appreciated. Thanks!
Sep 12, 2022, 10:48 AM
You can't set a CORS domain for the Asset CDN without also setting it for the other Sanity APIs, unfortunately.
Sep 19, 2022, 7:56 PM
Thanks for the reply – that would actually be fine, is it possible (by adding a CORS origin to the data API settings)? I can’t see any CORS headers on asset URL responses at the moment, and I do have a couple of origins configured in the management dashboard 😞
Sep 19, 2022, 8:48 PM
Just found an old issue where someone else is asking about this. If there’s any way to accomplish this I’d love to hear it! For clarity, anything that modifies CORS headers on the Data API as well is fine, but it does appear that the CORS settings in the control panel affect only the Data API and there’s no way to specify CORS origins for the Asset API.
Sep 27, 2022, 5:21 PM
I'll ask internally if there's any follow up for that issue.
Sep 27, 2022, 5:31 PM
Thank you! 🙏
Sep 27, 2022, 5:32 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?