http2_recv_timeout

The http2_recv_timeout directive sets the maximum time to wait for a client to send data over an HTTP/2 connection before timing out.

Syntaxhttp2_recv_timeout time;
Defaultnone
Contexthttp, server
Arguments1

Description

The http2_recv_timeout directive is applicable in http and server contexts and determines the length of time the server will wait for additional data to be received from a client on an HTTP/2 connection. If the specified time is exceeded and no data is received, the server will terminate the connection, closing the socket. This is crucial in controlling resource usage and ensuring that connections do not remain open indefinitely due to a lack of client activity.

The parameter for this directive is a time value, which can be expressed in seconds or in more granular units, allowing for precise control over the timeout duration. When adjusting this value, it is important to consider the nature of the client requests and expected connection patterns. If set too low, it may cause premature disconnections for clients that may take longer to send data; conversely, setting it too high could lead to resource exhaustion due to lingering idle connections.

In practice, the http2_recv_timeout directive complements other configuration parameters related to timeouts, allowing system administrators to fine-tune the server's responsiveness and resource management based on application requirements and expected traffic patterns.

Config Example

server {
    listen 443 ssl http2;
    http2_recv_timeout 10s;
}

Setting the timeout too low may inadvertently drop legitimate connections that take time to send data.

This directive only applies to HTTP/2 connections; ensure it's not confused with other timeout directives for different protocols.

← Back to all directives