diff --git a/docs/api-reference/cli.md b/docs/api-reference/cli.md index 1f1ffd9d3e27e..a1baeacccf5b6 100644 --- a/docs/api-reference/cli.md +++ b/docs/api-reference/cli.md @@ -108,9 +108,9 @@ PORT=4000 npx next start > Note: `PORT` can not be set in `.env` as booting up the HTTP server happens before any other code is initialized. -### Working with Load-balancer Timeouts +### Keep Alive Timeout -When deploying Next.js behind a downstream proxy (e.g. a load-balancer like AWS ELB/ALB) it's important to configure Next's underlying http-server with [keep-alive timeouts](https://nodejs.org/api/http.html#http_server_keepalivetimeout) that are _larger_ than the downstream proxies' timeouts. Otherwise, once a keep-alive timeout is reached for a given TCP connection, Node.js will immediately terminate that connection without notifying the downstream proxies. This results in the downstream proxies throwing intermittent 5xx errors whenever they attempt to reuse a connection that Node.js has already terminated. +When deploying Next.js behind a downstream proxy (e.g. a load-balancer like AWS ELB/ALB) it's important to configure Next's underlying HTTP server with [keep-alive timeouts](https://nodejs.org/api/http.html#http_server_keepalivetimeout) that are _larger_ than the downstream proxy's timeouts. Otherwise, once a keep-alive timeout is reached for a given TCP connection, Node.js will immediately terminate that connection without notifying the downstream proxy. This results in a proxy error whenever it attempts to reuse a connection that Node.js has already terminated. To configure the timeout values for the production Next.js server, pass `--keepAliveTimeout` (in milliseconds) to `next start`, like so: