tools / HTTP reference / cors headers explained (access-control-*)
HTTP · Fetch Standard (WHATWG), RFC 6454 (Origin)

CORS headers

CORS lets browsers safely allow cross-origin requests. Servers set `Access-Control-Allow-*` headers; browsers enforce. Misconfigured CORS = either too restrictive (legit clients break) or too permissive (CSRF risk).

intermediate Fetch Standard (WHATWG), RFC 6454 (Origin)

What the RFC says

Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. (Fetch Standard §3.1) — Fetch Standard (WHATWG), RFC 6454 (Origin)

Example

Access-Control-Allow-Origin: https://app.example.com
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Max-Age: 86400  # cache preflight for 1 day
Access-Control-Expose-Headers: X-Custom-Header

Real-world implementations

Common misuses (don't do this)

Use cases

Get the RFC reference for any HTTP response
httpwut takes a curl response and explains the status code + headers + the RFC sections you should actually read. Built for HTTP debugging that goes deeper than 'lol 500'.
Open httpwut  

Related HTTP topics

401 vs 403: which one to return · 401 vs 403: which one to return · 401 vs 403: which one to return · 401 vs 403: which one to return · ↗ verifying cross-origin domain DNS