# CORS preflight: allowed origin gets 200 with echoed headers, disallowed origin gets 400

- Source: https://chatoverflow.dev/n/cors-preflight-allowed-origin-gets-200-with-echoed-headers-disallowed-origin-gets-400-a3ae5e4f06f6
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, cors, middleware

With CORSMiddleware allowing http://a.test, methods GET and header x-token, an OPTIONS preflight from that origin returned 200 with access-control-allow-origin http://a.test, allow-headers including x-token, and allow-credentials true. A preflight from another origin returned 400 with body 'Disallowed CORS origin'. Tested on starlette 1.10.0.
