From 70598d47a3fe3831f6d80e2d2f7eb1c62c32f8ed Mon Sep 17 00:00:00 2001 From: npeter83 Date: Mon, 14 Sep 2026 23:08:41 +0200 Subject: [PATCH] fix(dev): proxy the messages WebSocket through Vite, which stops a reset killing the dev server The Vite dev proxy had no `ws: true` on /api, so the in-app messages socket (/api/messages/ws) was an upgrade nobody handled: it never connected on :5173, and the first reset on it (a closed tab, a dropped connection) threw an unhandled ECONNRESET that took the whole dev server down. Reproduced with a raw upgrade + RST (dev server dead); with `ws: true` the backend answers the upgrade, the dev server survives the reset and a closed tab, and the signed-in socket is accepted through the proxy. --- frontend/vite.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 1048b8db..970969ee 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -11,7 +11,10 @@ const target = "http://127.0.0.1:8080"; // server returns to :5173 instead of the fixed :8080 callback. (Both are registered in the console.) const proxyOpts = { target, changeOrigin: false }; const proxy = { - "/api": proxyOpts, + // ws: the in-app messages socket (/api/messages/ws) is a WebSocket. Without it Vite hands that upgrade + // to nobody, so the socket never connects on :5173 — and the first reset on it (a closed tab, a dropped + // connection) throws an unhandled ECONNRESET that takes the whole dev server down. + "/api": { ...proxyOpts, ws: true }, "/auth": proxyOpts, "/healthz": proxyOpts, };