This CORS error is enforced by the browser, but it is fixed on the API or proxy response, not in frontend fetch options alone.
Symptoms
- Browser console mentions No Access-Control-Allow-Origin.
- The same URL works in curl or Postman.
- Requests fail only from a different domain or port.
Likely causes
- API does not allow the frontend origin.
- Preflight OPTIONS response is missing CORS headers.
- Credentials are used with wildcard origins.
- A proxy or error response drops CORS headers.
Fix steps
- Check the actual response headers in browser devtools.
- Handle OPTIONS preflight on the API or proxy.
- Return a specific origin when credentials are used.
- Make error responses include the same CORS policy.
Verify the fix
- Test OPTIONS and real request separately.
- Inspect Access-Control-Allow-Origin and credentials headers.
- Confirm the failing response is not an HTML error page.
FAQ
Why does curl work?
curl is not a browser and does not enforce browser CORS rules.
Can mode no-cors fix it?
No. It creates an opaque response and usually hides the data you need.
Related tools and guides
Last updated: May 18, 2026