From b1b4fdffb49a7baac9179ee05ef8f3b98f3ecce5 Mon Sep 17 00:00:00 2001 From: Grant Date: Thu, 15 Feb 2024 19:43:18 -0700 Subject: [PATCH] dev: allow separate origins for backend & frontend --- packages/client-next/src/lib/network.ts | 1 + packages/server/src/index.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client-next/src/lib/network.ts b/packages/client-next/src/lib/network.ts index fe51e54..f48d23a 100644 --- a/packages/client-next/src/lib/network.ts +++ b/packages/client-next/src/lib/network.ts @@ -22,6 +22,7 @@ class Network extends EventEmitter { import.meta.env.VITE_API_HOST, { autoConnect: false, + withCredentials: true, } ); private online_count = 0; diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index df017e9..fcd9bf0 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -36,6 +36,10 @@ const session = expressSession({ client: redisClient, prefix: "canvas_session:", }), + cookie: { + sameSite: "none", + httpOnly: false, + }, }); const app = express(); const server = http.createServer(app); @@ -55,7 +59,8 @@ const io = new Server< } >(server, { cors: { - origin: "*", + origin: "http://10.1.10.248:5173", + credentials: true, }, });