mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
fix(server): keep idle connections open longer than Traefik's upstream timeout
The 65 s default sat above nginx's 60 s but below the 90 s Traefik keeps an idle upstream connection, so a default Traefik deployment could still reuse a socket Node had just closed and answer that request with a 502. 95 s clears both, and the headers timeout one second above it stays well under Node's 300 s request timeout and the 290000 cap the schema accepts. Also moves the stray RawEnv import in boot-derive.ts up to the other import.
This commit is contained in:
@@ -8,16 +8,18 @@
|
||||
* each side touches. A value that pre-container code needs, or that tests
|
||||
* mutate mid-lifetime, belongs in derive.ts instead.
|
||||
*/
|
||||
import type { RawEnv } from './derive';
|
||||
import { parseBool, positiveIntOr } from './parsers';
|
||||
|
||||
/**
|
||||
* Longer than the idle timeout of the common reverse proxies and load
|
||||
* balancers (60 s), so the proxy closes an idle upstream connection before
|
||||
* Node does. The other way round the proxy reuses a socket Node just closed
|
||||
* and answers that request with a 502.
|
||||
* Longer than the upstream idle timeout of the common reverse proxies and load
|
||||
* balancers (60 s for nginx and most load balancers, 90 s for Traefik), so the
|
||||
* proxy closes an idle upstream connection before Node does. The other way
|
||||
* round the proxy reuses a socket Node just closed and answers that request
|
||||
* with a 502. The headers timeout follows one second above, still well under
|
||||
* Node's 300 s request timeout.
|
||||
*/
|
||||
export const DEFAULT_KEEP_ALIVE_TIMEOUT_MS = 65_000;
|
||||
import type { RawEnv } from './derive';
|
||||
export const DEFAULT_KEEP_ALIVE_TIMEOUT_MS = 95_000;
|
||||
|
||||
/** What the pre-init Express layer and the HTTP server freeze when buildApp() runs. */
|
||||
export function deriveHttpBoot(raw: RawEnv) {
|
||||
|
||||
Reference in New Issue
Block a user