How can I enable CORS in FastAPI?
I'm trying to enable CORS in this very basic FastAPI example, however it doesn't seem to be working. from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=['*'] ) @app.get('/') def read_main(): return {'message': 'Hello World!'} This is the response I get: curl -v http