🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Troubleshooting CORS configuration for Sanity with custom domains

8 replies
Last updated: Sep 28, 2021
Hello, I have a question about configuring CORS origins. I have a frontend site hosted on netlify, and early on in development I configured my sanity instance to allow the randomly generated domain that netlify generated for the site to connect to the project. Now I have also added a custom domain that I bought on namecheap and setup that domain to point to the netlify site. The problem is that now when I try to whitelist my new custom domain on the sanity CORS page, it doesn’t appear to have any effect, and all my requests are blocked. Can you recommend that I try anything to resolve this problem? Thanks!
Sep 28, 2021, 8:12 PM
Hey User! What's the error you get in the console when this happens?
Sep 28, 2021, 8:23 PM
Hi User! This is what I see
No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Sep 28, 2021, 8:26 PM
Hi User! This is what I see
No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Sep 28, 2021, 8:26 PM
Sep 28, 2021, 8:28 PM
I noticed of course I can create a wildcard entry and it works, but I guess that is not ideal
Sep 28, 2021, 8:30 PM
I noticed of course I can create a wildcard entry and it works, but I guess that is not ideal
Sep 28, 2021, 8:30 PM
Hmm, is it possible that you've added
http://
instead of
https://
? Or maybe something along those lines?
Sep 28, 2021, 8:32 PM
OH! I think I got it. I ended up setting up two records, one with www and one without. I was trying to setup something with wildcards like this but it did not work. I guess maybe I misunderstood how * could be used.
https://*<http://landgrabct.org|landgrabct.org>*
Sep 28, 2021, 8:35 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?