CORS Error: "Unknown network error" connecting to Sanity Studio localhost

20 replies
Last updated: Nov 29, 2025
ISSUE resolved: Extension "HTTPS Everywhere" inside Chrome caused problem. Extension is deprecated as same feature is now available in Chrome Security settings. See also article .
Hello Hello,
after using Sanity last time in September 22 a lot has changed and I'm looking forward to try the new version of Sanity.
Unfortunately I always seem to fail at the simplest step when running
npm run dev
to connect to the sanity studio on my localhost.I updated node, npm, made sure I'm logged into the correct account (locally and web) and that the CORS localhost has full allowance.

Error:
Unknown network error attempting to reach nhj2bb7j.api.sanity.io
The console tells me that the Header Access-Control-Allow-Header has a value not equal to the origin.

I appreciate any hints to solve this error
🙌
AI Update

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:// vs https:// 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 thread
20 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.

Was this answer helpful?