mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-18 03:30:39 +09:00
fix: increase Node keepAliveTimeout behind reverse proxies to prevent 502s
- Set server.keepAliveTimeout to 185s to safely outlive default Traefik/AWS ALB idle timeouts (typically 60-180s) - Resolves random "Failed to fetch" edge cases caused by Node.js's notoriously short 5s default timeout Closes #3008
This commit is contained in:
parent
3e0ab97b12
commit
e2962e6528
1 changed files with 6 additions and 0 deletions
|
|
@ -542,6 +542,12 @@ export async function startServer(): Promise<StartedServer> {
|
||||||
resolveSession,
|
resolveSession,
|
||||||
});
|
});
|
||||||
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})`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue