Blocked by the browser · Needs a closer look
Blocked by CORS policy: No Access-Control-Allow-Origin header
Your browser is blocking a request to another website for security reasons. It’s like trying to peek into your neighbor’s house: the browser says no.
What the error looks like
Access to fetch at 'https://api.example.com' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Why it happens
Browsers block requests to different domains by default. The API server needs to explicitly allow your website to make requests to it.
How to fix it
- If you control the API: add CORS headers to allow your domain
- Use a server-side API route as a proxy (your server can make the request instead)
- Check that the API URL is correct and the service supports CORS
Ask your AI coding tool to fix it
Paste this prompt into Claude Code, Cursor, Bolt or Lovable, with your own error in place of the example.
I'm getting this error and I need help understanding and fixing it:
```
Access to fetch at 'https://api.example.com' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
```
Please:
1. Explain what this error means in plain English
2. Tell me the most likely cause
3. Give me the exact code changes or commands I need to fix it
4. Show me how to prevent this error in the future
Got a different error?
Paste any error into the free Error Decoder and get it explained in plain English, with a fix prompt.
Decode my error