From 22a2a225ba87029f0e7bbc09a80ff7cdad23399d Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Wed, 15 Jan 2025 12:42:39 +0400 Subject: Added "keepalive_min_timeout" directive. The directive sets a timeout during which a keepalive connection will not be closed by nginx for connection reuse or graceful shutdown. The change allows clients that send multiple requests over the same connection without delay or with a small delay between them, to avoid receiving a TCP RST in response to one of them. This excludes network issues and non-graceful shutdown. As a side-effect, it also addresses the TCP reset problem described in RFC 9112, Section 9.6, when the last sent HTTP response could be damaged by a followup TCP RST. It is important for non-idempotent requests, which cannot be retried by client. It is not recommended to set keepalive_min_timeout to large values as this can introduce an additional delay during graceful shutdown and may restrict nginx from effective connection reuse. --- src/http/ngx_http_request.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/http/ngx_http_request.h') diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 65c8333f8..9407f46ae 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -329,6 +329,8 @@ typedef struct { ngx_chain_t *free; + ngx_msec_t keepalive_timeout; + unsigned ssl:1; unsigned proxy_protocol:1; } ngx_http_connection_t; -- cgit