Newnessimworks.com
Glossary · Web development

CORS

Cross-Origin Resource Sharing — the browser security policy that controls which web pages can read responses from which APIs.

Definition

In long form.

By default, JavaScript on `https://example.com` can't read responses from `https://api.other.com` — that's the same-origin policy, a foundational web-security boundary. CORS is the negotiated exception: the API server includes specific Access-Control-Allow-Origin headers, the browser checks them, and either allows the JavaScript to read the response or blocks it. CORS only applies to browsers reading responses; it does not protect the server itself. Pre-flight OPTIONS requests handle non-simple requests (custom headers, methods other than GET/POST/HEAD).

In context

When a frontend can't talk to an API, the first check is the network tab for a CORS error. The fix is on the API server (allow the right origin), not the frontend. Spoiler: 'fixing CORS' on the frontend is impossible by design.

Discovery first

Talk to us about your engagement.

Discovery calls are free. Scope, timelines, and pricing are quoted after we understand what you’re solving.