Replace CORS origins by origin regex

This commit is contained in:
grossmj 2021-12-19 18:10:15 +10:30
parent d1d36ce254
commit 36cf43475d

View File

@ -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=["*"],