From 56fdbbcb96bad4d50a10dab84eb334d49c87be3f Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 18 Nov 2026 10:32:06 +0100 Subject: [PATCH] stop dev server 502s behind tailscale serve (#12496) Node closes idle keep-alive sockets after 5s while tailscale serve's Go reverse proxy keeps idle upstream connections for 90s, so requests sent after a short pause land on closing sockets and come back as empty 502s. Raise the dev server's keepAliveTimeout above the proxy's. Also stop watching .fast-check/: check:fast rewrites its tsconfig.json on every run, which makes vite clear its cache and full-reload every tab. Co-authored-by: Claude Opus 5.5 --- frontend/vite.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 36b84e9903..9a7e501ea9 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -375,6 +375,14 @@ let plugin = { name: 'configure-response-headers', enforce: 'pre', configureServer: (server) => { + // Node closes an idle keep-alive socket after 5s, while a Go reverse proxy in front of + // the dev server (`tailscale serve`) keeps idle upstream connections for 90s. A request + // sent on a socket Node is closing comes back as a 502 with no body, which breaks the + // module graph after any pause of a few seconds. Outlive the proxy's idle timeout. + if (server.httpServer) { + server.httpServer.keepAliveTimeout = 120_000 + server.httpServer.headersTimeout = 121_000 + } server.middlewares.use((req, res, next) => { if (needsCrossOriginIsolation(req.url ?? '')) { res.setHeader('Cross-Origin-Opener-Policy', 'same-origin') @@ -410,6 +418,9 @@ const config = { 'public.windmill.xyz' ], port: parseInt(process.env.FRONTEND_PORT) || 3000, + // `npm run check:fast` rewrites .fast-check/tsconfig.json on every run, and vite answers a + // tsconfig change by clearing its transform cache and full-reloading every open tab. + watch: { ignored: ['**/.fast-check/**'] }, // Transform the app shell's module graph at startup rather than on the first page // load, which otherwise sits on the loading screen for ~15s (Tailwind's full content // scan for app.css alone takes several seconds).