Skip to content

Commit

Permalink
main.py: add CORSMiddleware for non-dev env
Browse files Browse the repository at this point in the history
Signed-off-by: Vallari Agrawal <[email protected]>
  • Loading branch information
VallariAg committed Aug 30, 2024
1 parent 6c4b5f4 commit 2043d97
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/teuthology_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def read_root(request: Request):
allow_methods=["*"],
allow_headers=["*"],
)
else:
app.add_middleware(
CORSMiddleware,
allow_origins=[PULPITO_URL, PADDLES_URL],
allow_credentials=True,
allow_methods=["GET", "POST", "OPTIONS"],
allow_headers=["Cookie"],
)

app.add_middleware(SessionMiddleware, secret_key=SESSION_SECRET_KEY)
app.include_router(suite.router)
Expand Down

0 comments on commit 2043d97

Please sign in to comment.