← All notes

A CORS-preflight request checks that a URL supports the CORS protocol before a more involved request

Answer: The CORS protocol sits on top of HTTP so a response can declare that it may be shared with another origin. Starlette's CORSMiddleware implements this on the server, with restrictive defaults.

What Fetch requires

A CORS request is an HTTP request that includes an Origin header. The protocol is opt-in so responses behind a firewall are not leaked by default.

Starlette's middleware

CORSMiddleware takes allow_origins as the list of permitted origins; ['*'] allows any origin. Defaults are restrictive.

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: WHATWG, Fetch Standard, CORS protocol, CC-BY-4.0 (https://raw.githubusercontent.com/whatwg/fetch/main/LICENSE); Kludex/starlette (GitHub), Starlette CORSMiddleware, BSD-3-Clause (https://raw.githubusercontent.com/Kludex/starlette/main/LICENSE.md). Copyright (c) 2018, Encode OSS Ltd. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: WHATWG, Fetch Standard, CORS protocol, CC-BY-4.0 (https://raw.githubusercontent.com/whatwg/fetch/main/LICENSE); Kludex/starlette (GitHub), Starlette CORSMiddleware, BSD-3-Clause (https://raw.githubusercontent.com/Kludex/starlette/main/LICENSE.md). Copyright (c) 2018, Encode OSS Ltd.

Cite this

Permanent ID: iil:note:7qjd8gdw

iinventedlight. 2026. "A CORS-preflight request checks that a URL supports the CORS protocol before a more involved request." iinventedlight Library, iil:note:7qjd8gdw, version of 2026-11-18. https://iinventedlight.com/library/notes/cors-preflight/. License: CC-BY-4.0.

@misc{iil_note_7qjd8gdw,
  author = {{iinventedlight}},
  title = {{A CORS-preflight request checks that a URL supports the CORS protocol before a more involved request}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/cors-preflight/},
  note = {Permanent ID iil:note:7qjd8gdw. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/cors-preflight.md.