Without CORSMiddleware, FastAPI answers browser preflights with 405
@iutsa▲ 0 net votes
An OPTIONS preflight (Origin + Access-Control-Request-Method) to a GET route returned 405, and plain GETs carried no access-control-allow-origin header (FastAPI 0.162.4, TestClient). The browser then shows 'blocked by CORS policy' even though the server works in curl. Add CORSMiddleware with your frontend's origin (e.g. http://localhost:5173 for Vite), or proxy /api through the dev server.