Skip to content

Troubleshooting guide

499 Client Closed Request in Nginx: what it means

A 499 is an Nginx-specific log code. The client hung up before Nginx could answer, and that is often a slow backend wearing a disguise.

3 min read10 sectionsUpdated

On this page

Key points

  • 499 is logged, never sent: the client is already gone.
  • A spike means your backend got slower far more often than users got impatient.
  • A load balancer can be the "client" when its timeout is shorter than Nginx's.
  • The upstream may keep working on a request nobody is waiting for.

What 499 means

Nginx invented this code for its access log, for the case where the client closed the connection while Nginx was still processing. It does not appear in the HTTP standard, and clients never receive it. If the client is a browser, the user navigated away or a script aborted the call. If the client is a load balancer, that balancer ran out of patience.

Common causes

  • A slow upstream, so clients abort before it replies.
  • Timeout mismatch. An ALB with a 60-second idle timeout in front of an Nginx allowing 120 seconds will produce 499s at exactly 60 seconds.
  • Aborted fetches from type-ahead search, where each keystroke legitimately cancels the previous request.
  • Mobile users switching networks.
  • Health checks with short timeouts against a saturated server, which can also lead to instances being removed.

Is it harmless?

Look at the $request_time of those entries. If 499s cluster at a round number, a client timeout is involved. If they are widely spread on one search route, they are probably cancellations.

bash
# Add timing to your log_format first:
# log_format t '$status $request_time $upstream_response_time $request';

# 499s per path
awk '$1 == 499 {print $4}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

# Distribution of how long clients waited
awk '$1 == 499 {printf "%d\n", $2}' /var/log/nginx/access.log | sort -n | uniq -c | tail -15

Fixes

Fix the slow request, which is the real problem: find it with distributed tracing and look at database time first. Align timeouts so that each layer gives up slightly before the layer in front of it. Abort work when the client leaves, so the backend does not continue an expensive query. Be careful with proxy_ignore_client_abort on;, because it hides the symptom by continuing the work.

Catch it automatically

Add 499s to your error rate for server-to-server traffic, but keep browser routes separate, or normal cancellations will drown the signal. Compare the 499 rate with p95 latency in APM: when both climb together, you have a backend slowdown and not a behaviour change.

Frequently asked questions

Do clients ever see a 499?

No. It only appears in Nginx logs, because the client has already disconnected.

Are 499 errors bad?

A low steady number is normal. A spike that follows a latency increase means real users are giving up.

Why do 499s stop at exactly 60 seconds?

A client or load balancer in front of Nginx has a 60-second timeout. Compare the timeouts on each layer.

Check it now, free

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.