Blog › Web · Published 2026-11-26

Fix: "No Access-Control-Allow-Origin header is present on the requested resource"

This is a browser security rule called CORS (Cross-Origin Resource Sharing). Your page on one origin asked for data from another origin, and the response did not say the browser is allowed to share it.

The fix is on the server

The server that owns the API must add a response header that allows your origin:

Access-Control-Allow-Origin: https://your-site.example

Using * allows any origin, but it cannot be combined with credentials such as cookies.

Preflight requests

For some requests (for example with custom headers or methods like PUT or DELETE) the browser first sends an OPTIONS request. The server must answer it with the matching headers:

Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization

What does not fix it

If you do not control the API, call it from your own backend instead, because CORS applies to browsers, not to server-to-server calls.

Official sources

Need help with your project?
We build websites, systems and automation. Start your project WhatsApp

All articles