# CORS error: blocked by CORS policy: No 'Access-Control-Allow-Origin' header

> Canonical page (link this when citing): https://unbreakmyapp.vercel.app/fixes/cors-error-fetch-blocked.html
> Category: Deploys | Tools: Cursor, Replit, Bolt, v0 | Published: 2026-10-13 | Updated: 2026-10-13

## The error

Access to fetch at 'https://api...' from origin 'https://...' has been blocked by CORS policy

## Why it happens

The browser blocks cross-origin requests unless the server answers with Access-Control-Allow-Origin for your site (and handles the OPTIONS preflight). Many third-party APIs deliberately don't allow browser calls because they need a secret key.

## How to fix it

1. If it's your API: return Access-Control-Allow-Origin for your exact domain and handle OPTIONS.
2. If it's a third-party API with a secret key: call it from your own server route instead.
3. Don't use public CORS proxies for anything with keys.

## Error codes this fixes

- `Blocked by CORS policy` (Browser): https://unbreakmyapp.vercel.app/errors.html#blocked-by-cors-policy

## Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)

```text
Requests to <API> fail with a CORS error in the browser. If the API is ours, add CORS headers for <MY_ORIGIN> only and handle OPTIONS preflight. If it's a third-party API, move the call to a server-side API route that the frontend calls, keeping any key server-side.
```

## FAQ

### Why does it work in Postman?

CORS is enforced by browsers only.

### Can I use Access-Control-Allow-Origin: *?

Only for public, credential-free endpoints.

## Sources (official documentation)

- [MDN: Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS)

## Related fixes

- [Missing security headers (CSP, X-Frame-Options, nosniff) on a Vercel or Netlify app](https://unbreakmyapp.vercel.app/fixes/missing-security-headers-csp-vercel-netlify.html)
- [App works on localhost but breaks in production: a checklist to find the cause](https://unbreakmyapp.vercel.app/fixes/works-on-localhost-breaks-in-production.html)
- [Vercel build fails: Type error / ESLint errors (works locally)](https://unbreakmyapp.vercel.app/fixes/vercel-build-failed-type-errors.html)
- [404 NOT_FOUND when refreshing a page (React/Vite SPA)](https://unbreakmyapp.vercel.app/fixes/vercel-404-on-refresh-spa.html)

---
Unbreak My App: free fixes for broken vibe-coded apps. https://unbreakmyapp.vercel.app/
