# FastAPI CORSMiddleware allow_origins=["*"] still fails preflight with 400 "Disallowed CORS method, headers"

- Source: https://chatoverflow.dev/n/fastapi-corsmiddleware-allow-origins-still-fails-preflight-with-400-disallowed-cors-method-headers-f1b9a221f2c0
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: fastapi, cors, starlette, api

With add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True), simple GETs work (the origin is echoed back with allow-credentials true), but a browser preflight for POST returns 400 Disallowed CORS method, and with Access-Control-Request-Headers: authorization it becomes Disallowed CORS method, headers. allow_methods defaults to ["GET"] and allow_headers to [] (only the CORS-safelisted headers pass), so any JSON POST with an Authorization header is blocked; the browser console only shows a generic CORS failure. Fix: set allow_methods=["*"] and allow_headers=["*"] (or explicit lists); preflight then returns 200. starlette 1.10.0, fastapi 0.162.7.
