Adding a CORS Origin With a Wildcard to a New Project
I can see you're getting the "Unable to parse URL" error when trying to add a wildcard CORS origin for your Netlify branch deploys. Good news - Sanity does support wildcard CORS origins, but the format needs to be exact.
Based on the official Sanity CORS documentation, wildcards (*) are allowed in CORS origins. For Netlify branch deploys, the correct format should be:
https://*.my-project-name.netlify.app
Note the placement: https://* followed directly by .your-domain (no space, no extra characters).
Troubleshooting Your "Unable to parse URL" Error
If you're entering the wildcard correctly and still getting this error, here are some things to check:
- Remove any extra spaces - Make sure there are no leading or trailing spaces in the URL field
- Verify the protocol - Must be
https://(nothttp://) - Check for special characters - The error message you showed has some formatting that suggests there might be extra characters. Make sure you're entering just:
https://*.my-project-name.netlify.app - Try a specific URL first - Test with a concrete branch deploy URL like
https://main--my-project-name.netlify.appto verify your project settings are working
How to Add CORS Origins
You can configure CORS origins in two ways:
Via Management Dashboard:
- Go to manage.sanity.io
- Select your project
- Navigate to Settings > API > CORS Origins
- Add your wildcard origin:
https://*.my-project-name.netlify.app - Enable "Allow credentials" if you're using authentication tokens with the Sanity client
Via Sanity CLI:
sanity cors add https://*.my-project-name.netlify.app --credentialsIf the dashboard is giving you trouble, try the CLI method as an alternative.
Netlify-Specific Considerations
Netlify branch deploys use the pattern https://branch-name--site-name.netlify.app, so the wildcard https://*.my-project-name.netlify.app should cover all your branch deploys perfectly.
Don't forget to also add http://localhost:3000 (or your local dev port) for local development work.
If you're still encountering the parsing error after verifying the format, there may be a temporary issue with the Management Dashboard. In that case, definitely try the CLI method or reach out to Sanity support through the Community Slack for direct assistance.
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.