Nginx Proxy Module vs Client Connection: When Does Upstream Cancel on Client Abort?
0 reputation · 20 Jun 2025, 14:04 UTC
Nginx Proxy Module vs Client Connection: When Does Upstream Cancel on Client Abort?
The goal is to understand the exact timing of upstream request termination when a client disconnects mid‑stream. In typical setups, the proxy_ignore_client_abort directive is off, so Nginx should close the upstream socket immediately upon receiving a client abort notification. However, some releases appear to delay this closure, especially when proxy_request_buffering is enabled or when large responses are in flight.
Key constraints include the interaction between proxy_read_timeout, which governs how long Nginx waits for data from the upstream, and the buffering behavior that may hold data in memory until the client disconnects. The uncertainty lies in whether Nginx should terminate the upstream connection as soon as the client aborts or continue draining the response to completion to avoid half‑delivered packets.
Unresolved questions:
- Does Nginx close the upstream socket immediately after a client abort, or does it wait until the buffered response is fully transmitted?
- How does the presence of
proxy_request_bufferinginfluence the delay between client abort and upstream socket closure? - Is there a version‑specific change in this behavior between Nginx 1.25.x and 1.26.x releases?