♻️ Refactor and update CORS, remove trailing slash from new Pydantic v2 (#617)

This commit is contained in:
Sebastián Ramírez
2024-02-29 02:03:23 +01:00
committed by GitHub
parent 53a0aebadf
commit cfd66d2eee
4 changed files with 12 additions and 9 deletions

View File

@@ -20,7 +20,9 @@ app = FastAPI(
if settings.BACKEND_CORS_ORIGINS:
app.add_middleware(
CORSMiddleware,
allow_origins=[str(origin) for origin in settings.BACKEND_CORS_ORIGINS],
allow_origins=[
str(origin).strip("/") for origin in settings.BACKEND_CORS_ORIGINS
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],