server.headersTimeout


限制解析器等待接收完整 HTTP 头的时间。

🌐 Limit the amount of time the parser will wait to receive the complete HTTP headers.

在不活动的情况下,将适用 server.timeout 中定义的规则。然而,如果头部数据发送非常缓慢(默认情况下,每 2 分钟最多 发送一个字节),基于不活动的超时仍然可能允许连接保持打开状态。为了防止这种情况,每当头部数据到达时,会进行一次额外检查,以确保自连接建立以来未超过 server.headersTimeout 毫秒。如果检查失败,将在服务器对象上触发 'timeout' 事件,并且(默认情况下)套接字将被销毁。有关如何自定义超时行为的更多信息,请参见 server.timeout

🌐 In case of inactivity, the rules defined in server.timeout apply. However, that inactivity based timeout would still allow the connection to be kept open if the headers are being sent very slowly (by default, up to a byte per 2 minutes). In order to prevent this, whenever header data arrives an additional check is made that more than server.headersTimeout milliseconds has not passed since the connection was established. If the check fails, a 'timeout' event is emitted on the server object, and (by default) the socket is destroyed. See server.timeout for more information on how timeout behavior can be customized.