Skip to content

What does 'No 'Access-Control-Allow-Origin' header is present on the requested resource' mean?

Short answer

The browser blocked your frontend from reading an API response because the server didn't send Access-Control-Allow-Origin for your site's origin. Fix it on the API server by allowing your exact origin(s). Don't use a browser extension, a public CORS proxy, or a blanket * on endpoints that use cookies.

Last updated 2026-11-25 · Reviewed by ProofForge

The exact error

text
Access to fetch at 'https://api.example.com/data' from origin 'https://app.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Why it happens

  • The API has no CORS configuration, or it doesn't list your production domain (works on localhost, fails live).
  • The preflight OPTIONS request returns an error (404/401/500), so no CORS headers are sent.
  • You're calling a third-party API directly from the browser that's meant to be called from a server, often with a secret key.

How to fix it

  1. Add your exact origins to the API's allowlist and answer preflight requests:
  2. If it's a third-party API that needs a secret key, call it from your own server route instead and keep the key there.
js
// Express
import cors from 'cors'
app.use(cors({
  origin: ['https://app.example.com'],
  credentials: true
}))

Check it's fixed

In DevTools → Network, the response has access-control-allow-origin: https://app.example.com. A request with Origin: https://evil.example doesn't get that header.

Check your live app

A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.

Read-only. No writes or row contents.

FAQ

Why does it work in Postman and curl?

CORS is enforced by browsers only. It controls which websites may read the response in a user's browser.

Can I just send Access-Control-Allow-Origin: *?

Only for truly public, cookie-less data. With credentials it isn't allowed, and reflecting any origin lets any site read your users' data.

Is a CORS proxy OK?

Not for production. It routes your users' requests through someone else's server.

Sources

Related

Read as Markdown · Scan methodology