Skip to content

The open-source app everyone uses to manage agents at work

fix: increase Node keepAliveTimeout behind reverse proxies to prevent 502s

Khairule2962e6528a1
diff --git a/server/src/index.ts b/server/src/index.ts
index b417f14c73..a384342f5e 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -542,6 +542,12 @@ export async function startServer(): Promise<StartedServer> {
resolveSession,
});
const server = createServer(app as unknown as Parameters<typeof createServer>[0]);
+
+ // Increase keep-alive timeouts to safely outlive default idle timeouts
+ // of common reverse proxies and load balancers (like AWS ALB, Nginx, or Traefik).
+ // This prevents intermittent 502/ECONNRESET errors caused by Node's 5s default.
+ server.keepAliveTimeout = 185000;
+ server.headersTimeout = 186000;
if (listenPort !== config.port) {
logger.warn(`Requested port is busy; using next free port (requestedPort=${config.port}, selectedPort=${listenPort})`);