From b788aa40a61619ff95e3a8940153f9ae6b6843bb Mon Sep 17 00:00:00 2001 From: Vallari Agrawal Date: Fri, 30 Aug 2024 10:37:31 +0530 Subject: [PATCH] [DNM] main.py: allow CORS methods and headers allow_methods: POST and OPTIONS (GET was allowed by default) allow_headers: "*" Signed-off-by: Vallari Agrawal --- src/teuthology_api/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/teuthology_api/main.py b/src/teuthology_api/main.py index c1d8afb..93424a2 100644 --- a/src/teuthology_api/main.py +++ b/src/teuthology_api/main.py @@ -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=["*"], + ) app.add_middleware(SessionMiddleware, secret_key=SESSION_SECRET_KEY) app.include_router(suite.router)