From 3c2603c88acf97ea0824b054102f8bba4ca1177b Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Mon, 17 Jun 2024 17:53:02 -0700 Subject: [PATCH] add back cors stuff --- store/app/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/store/app/main.py b/store/app/main.py index ff50d0d8..1abe9e38 100644 --- a/store/app/main.py +++ b/store/app/main.py @@ -12,6 +12,12 @@ from store.app.routers.part import parts_router from store.app.routers.robot import robots_router from store.app.routers.users import users_router +from store.settings import settings + +LOCALHOST_URLS = [ + "http://127.0.0.1:3000", + "http://localhost:3000", +] @asynccontextmanager @@ -29,7 +35,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: # Adds CORS middleware. app.add_middleware( CORSMiddleware, - allow_origins=["*"], + allow_origins={settings.site.homepage, *LOCALHOST_URLS}, allow_credentials=True, allow_methods=["*"], allow_headers=["*"],