forked from farhoodlabs/paperclip
Merge pull request #3009 from KhairulA/fix/keepalive-timeout
fix: increase Node keepAliveTimeout behind reverse proxies to prevent…
This commit is contained in:
@@ -543,6 +543,12 @@ export async function startServer(): Promise<StartedServer> {
|
|||||||
});
|
});
|
||||||
const server = createServer(app as unknown as Parameters<typeof createServer>[0]);
|
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) {
|
if (listenPort !== config.port) {
|
||||||
logger.warn(`Requested port is busy; using next free port (requestedPort=${config.port}, selectedPort=${listenPort})`);
|
logger.warn(`Requested port is busy; using next free port (requestedPort=${config.port}, selectedPort=${listenPort})`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user