Open RA-Zagros opened 3 years ago
I had to add the middleware after Declaring the VersionedFastAPI. So this should hopefully fix it:
app = FastAPI(title='APP NAME')
APP_VERSION = "1.1.1"
app.include_router(api_router_v1_0, prefix=config.API_V1_STR)
app.include_router(api_router_v1_1, prefix=config.API_V1_STR)
app = VersionedFastAPI(app)
app.add_middleware(
CORSMiddleware,
allow_origin_regex='https?://.*',
allow_credentials=True,
allow_methods=['*'],
allow_headers=['*'],
)
Describe the bug When using
VersionedFastAPI
all OPTIONS requests return a 405.To Reproduce Steps to reproduce the behavior:
VersionedFastAPI
Expected behavior Options request to pass as expected