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
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.
# 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 -15Fixes
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.
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
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- 400 Bad Request: what it means and how to fix it: Fix a 400 Bad Request error: oversized cookies, malformed URLs, invalid JSON bodies and proxy rules, with commands to find which layer rejected it.
- 403 Forbidden: what it means and how to fix it: Fix 403 Forbidden errors: file permissions, missing index files, WAF and bot rules, IP allowlists, expired signed URLs and missing API scopes, step by step.
- 408 Request Timeout: causes and how to fix it: Understand 408 Request Timeout: slow client uploads, idle keep-alive connections and proxy settings, and how it differs from a 504 Gateway Timeout.
- 410 Gone: what it means and when to use it: 410 Gone explained: how it differs from 404, how search engines treat it, when to remove pages with 410, and how to fix a 410 you did not expect.
- 413 Request Entity Too Large: how to raise the limit safely: Fix 413 Request Entity Too Large in Nginx, Apache, Node.js, PHP and Kubernetes ingress: find which layer sets the limit and raise it safely for uploads.
- 429 Too Many Requests: what it means and how to fix it: 429 Too Many Requests explained: rate limits, the Retry-After header, backoff with jitter for clients, and how to set fair rate limits on your own API.
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.