From: Michael Tremer Date: Sun, 15 Jun 2025 13:42:18 +0000 (+0000) Subject: API: Add the CORS middleware X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c890d5f1c5d7ff10c8f80663b70aeed22c0397bc;p=pbs.git API: Add the CORS middleware Signed-off-by: Michael Tremer --- diff --git a/src/api/app.py b/src/api/app.py index ad273304..3546ae99 100644 --- a/src/api/app.py +++ b/src/api/app.py @@ -19,6 +19,7 @@ ############################################################################### import fastapi +import fastapi.middleware.cors app = fastapi.FastAPI( title = "Pakfire Build Service API", @@ -27,3 +28,12 @@ app = fastapi.FastAPI( # Enable debug mode debug = True, ) + +# Add CORS +app.add_middleware( + fastapi.middleware.cors.CORSMiddleware, + allow_origins=["https://pakfire.ipfire.org"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +)