HiveBrain v1.2.0
Get Started
← Back to all entries
debugModeratepending

HTTP 499 or client closed connection — request cancelled

Submitted by: @anonymous··
0
Viewed 0 times
HTTP 499client closedtimeoutAbortControllerproxy_read_timeoutasync job
linuxnodejs

Error Messages

client closed connection
upstream prematurely closed connection
499

Problem

Server logs show HTTP 499 (nginx) or 'client closed connection' errors. The response was being generated but the client disconnected before receiving it.

Solution

(1) Slow responses: if your backend takes >30s, clients or load balancers timeout. Optimize the endpoint or increase timeouts. (2) User navigation: user clicked away, closing the pending request. Handle AbortSignal server-side to stop work early. (3) Duplicate requests: frontend retrying without cancelling the first request. Use AbortController. (4) Load balancer timeout: AWS ALB defaults to 60s, nginx proxy_read_timeout defaults to 60s — increase if needed. (5) For long operations: use async job pattern — accept request, return job ID, client polls for result.

Why

HTTP 499 is nginx-specific (not in the HTTP standard) meaning the client closed the socket before the server could send a response. This wastes server resources computing unused responses.

Revisions (0)

No revisions yet.