diff --git a/backend/chainlit/server.py b/backend/chainlit/server.py index 1936646f2b..49dd5c7e40 100644 --- a/backend/chainlit/server.py +++ b/backend/chainlit/server.py @@ -187,12 +187,8 @@ def get_build_dir(local_target: str, packaged_target: str) -> str: app = FastAPI(lifespan=lifespan) -ws_cors = ( - "*" if config.project.allow_origins[0] == "*" else config.project.allow_origins -) - sio = socketio.AsyncServer( - cors_allowed_origins=ws_cors, cors_credentials=True, async_mode="asgi" + async_mode="asgi" ) asgi_app = socketio.ASGIApp( @@ -202,11 +198,9 @@ def get_build_dir(local_target: str, packaged_target: str) -> str: app.mount(f"{PREFIX}/ws/socket.io", asgi_app) -http_cors = config.project.allow_origins - app.add_middleware( CORSMiddleware, - allow_origins=http_cors, + allow_origins=config.project.allow_origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], diff --git a/cypress/e2e/copilot/.chainlit/config.toml b/cypress/e2e/copilot/.chainlit/config.toml index e2a93af08f..9183c3c84b 100644 --- a/cypress/e2e/copilot/.chainlit/config.toml +++ b/cypress/e2e/copilot/.chainlit/config.toml @@ -13,7 +13,7 @@ session_timeout = 3600 cache = false # Authorized origins -allow_origins = ["*"] +allow_origins = ["http://localhost:8080"] # Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317) # follow_symlink = false