From 36cf43475dfd6b32bda250358975b9a6cd30c19f Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 19 Dec 2021 18:10:15 +1030 Subject: [PATCH] Replace CORS origins by origin regex --- gns3server/api/server.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/gns3server/api/server.py b/gns3server/api/server.py index b4f6e4ca..d0f14d78 100644 --- a/gns3server/api/server.py +++ b/gns3server/api/server.py @@ -53,22 +53,9 @@ def get_application() -> FastAPI: title="GNS3 controller API", description="This page describes the public controller API for GNS3", version="v3" ) - origins = [ - "http://127.0.0.1", - "http://localhost", - "http://localhost:4200", - "http://127.0.0.1:4200" - "http://127.0.0.1:8080", - "http://localhost:8080", - "http://127.0.0.1:3080", - "http://localhost:3080", - "http://gns3.github.io", - "https://gns3.github.io", - ] - application.add_middleware( CORSMiddleware, - allow_origins=origins, + allow_origin_regex=r"http(s)?://(localhost|127.0.0.1)(:\d+)?", allow_credentials=True, allow_methods=["*"], allow_headers=["*"],