diff --git a/doc/api/http.md b/doc/api/http.md index 295c9e3642d..8aa2e45c8f1 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1942,18 +1942,39 @@ added: v8.0.0 The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket -will be destroyed. If the server receives new data before the keep-alive -timeout has fired, it will reset the regular inactivity timeout, i.e., -[`server.timeout`][]. +will be destroyed. + +This timeout value is combined with the +\[`server.keepAliveTimeoutBuffer`]\[] option to determine the actual socket +timeout, calculated as: +socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer +If the server receives new data before the keep-alive timeout has fired, it +will reset the regular inactivity timeout, i.e., [`server.timeout`][]. A value of `0` will disable the keep-alive timeout behavior on incoming connections. -A value of `0` makes the http server behave similarly to Node.js versions prior +A value of `0` makes the HTTP server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections. +### `server.keepAliveTimeoutBuffer` + + + +* Type: {number} Timeout in milliseconds. **Default:** `1000` (1 second). + +An additional buffer time added to the +[`server.keepAliveTimeout`][] to extend the internal socket timeout. + +This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing +the socket timeout slightly beyond the advertised keep-alive timeout. + +This option applies only to new incoming connections. + ### `server[Symbol.asyncDispose]()`