CORS Error: "Unknown network error" connecting to Sanity Studio localhost
Great that you resolved it! For anyone else encountering similar CORS-related issues with Sanity Studio, here are the key troubleshooting steps:
Common CORS Configuration Issues
When you see errors like "Unknown network error" or "Access-Control-Allow-Header" issues when connecting to your Sanity Studio on localhost, here's what to check:
1. Verify CORS Origins Settings
Make sure your localhost is properly configured in your CORS settings:
- Go to manage.sanity.io → Your Project → Settings → API → CORS Origins
- Add
http://localhost:3000(or whatever port you're using) - Important: Enable the "Allow credentials" checkbox if you're using authentication tokens
- The protocol matters:
http://vshttps://must match exactly
2. Browser Extensions Can Interfere
As you discovered, browser extensions can cause CORS issues even when your configuration is correct. Common culprits include:
- HTTPS Everywhere (now deprecated - Chrome has this built-in)
- Privacy/security extensions
- Ad blockers
- VPN extensions
Try testing in an incognito/private window to rule out extension interference.
3. Clear Browser Cache
Sometimes stale CORS headers get cached. Try:
- Hard refresh (Ctrl+Shift+R / Cmd+Shift+R)
- Clear browser cache
- Restart your dev server
4. Double-Check Your Project ID
Make sure the project ID in your sanity.config.ts matches the project you've configured CORS for in the Management Dashboard.
5. Local Development Port
If you changed your dev server port, remember to add the new localhost URL to your CORS origins. Each port is treated as a different origin.
The fact that a browser extension was causing this is a good reminder that CORS errors aren't always about your Sanity configuration - sometimes the browser environment itself is the issue! Thanks for sharing the solution - it'll definitely help others who run into the same problem.
Show original thread20 replies
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.