Answer
Same-Origin Policy blocks JS from reading cross-origin responses. CORS is a server-controlled relaxation via HTTP headers.
Simple requests (GET/POST with safelisted headers) go directly; browser checks Access-Control-Allow-Origin on response.
Preflight (OPTIONS) happens for "non-simple" requests (custom headers, PUT/DELETE, Content-Type: application/json). Browser sends Access-Control-Request-Method/Headers; server must respond with matching allow headers before the real request.
Key headers:
Access-Control-Allow-Origin— specific origin or*(no credentials with*)Access-Control-Allow-Credentials: true+ explicit origin (required for cookies)Access-Control-Allow-Methods,Access-Control-Allow-HeadersAccess-Control-Max-Age— cache preflight