nginx 499 Client Closed Request: what it means and when to worry

A 499 in your nginx log means the client hung up before your server answered. How to tell harmless aborts from real slowness, and how to align timeouts to stop them.

· 6 min read · By the Spot Downtime team

Status 499 is not part of the HTTP standard. nginx invented it for its own access log: it records 499 when the client closed the connection before nginx finished sending a response. The visitor never receives a 499, because nobody is left to receive it. You only see it in your logs, and the question is whether it signals a real problem or just people closing tabs.

What a 499 actually tells you

nginx accepted the request, passed it to your application (or started to), and then the client went away. Someone, somewhere, gave up waiting. That someone could be:

  • A user who closed the tab, hit Stop, or navigated to another page.
  • A mobile app or script with a short request timeout.
  • A load balancer or CDN in front of nginx whose timeout is shorter than your app's response time.
  • A health checker or monitor with a tight timeout.
  • A browser or client that retried, cancelling the first attempt.

A handful of 499s on slow pages is normal. A steady stream on one endpoint, or a sudden jump after a deploy, means responses have become slower than the callers will wait.

Find where they come from

In the default combined log format the status is the ninth field and the request path the seventh. Count 499s by path:

bash
awk '$9 == 499 { print $7 }' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20

Then compare with the total per path, so you know the share and not just the count:

bash
awk '{ total[$7]++; if ($9 == 499) abort[$7]++ }
     END { for (p in abort) printf "%6d / %-6d %s\n", abort[p], total[p], p }' \
  /var/log/nginx/access.log | sort -rn | head -20

The default format doesn't record how long the request lasted before the client left. Add $request_time and $upstream_response_time to a custom format:

nginx
log_format timed '$remote_addr - $remote_user [$time_local] "$request" '
                '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
                'rt=$request_time urt=$upstream_response_time';

access_log /var/log/nginx/access.log timed;

Now the 499 lines show how long the client waited. If many cluster around the same number, such as rt=5.000 or rt=60.000, a timeout somewhere is set to that value. That is your culprit.

Align the timeouts

Timeouts should grow as you move toward the application: the client waits the longest, and each layer behind it gives up a little sooner so it can return a proper error. When they are the wrong way round, the outer layer hangs up first and the inner layers log 499s or keep working for nothing.

  • Client or load balancer: an AWS Application Load Balancer defaults to a 60-second idle timeout, and logs its own 460 when the client closes first. Check the setting on whatever sits in front of nginx.
  • nginx: proxy_read_timeout defaults to 60 seconds. If it fires you get a 504, not a 499. See upstream timed out.
  • Application: database and API timeouts should be shorter than all of the above.

Should nginx keep going after the client leaves?

By default nginx closes the connection to the upstream when the client disconnects, which tells your app the request was abandoned. That is usually right: it frees capacity. For requests that must finish regardless, such as a POST that writes to the database or fires a payment, you can tell nginx to ignore the abort:

nginx
location /api/orders {
    proxy_pass http://app;
    proxy_ignore_client_abort on;   # let the upstream finish even if the client left
}

Don't use it as a blanket setting

With proxy_ignore_client_abort on, abandoned slow requests keep consuming workers. Use it only on endpoints where finishing the work matters more than saving the capacity, and make those handlers idempotent so a user retrying doesn't duplicate the action.

When 499 is not a problem

  • Autocomplete and search-as-you-type: the browser cancels the previous request on every keystroke. Expect plenty of 499s.
  • Long-polling or streaming endpoints that clients drop and reopen.
  • Pages where users bounce quickly before images or lazy data finish loading.

For these, exclude 499 from your error-rate alerts. Count 5xx as errors and track 499s separately as a latency signal.

When 499 is a problem

  • The rate rises on endpoints that matter, like login or checkout.
  • The abandoned requests are all slow ones, which means users are leaving because pages take too long.
  • A monitoring check or webhook sender shows up in the 499s: its timeout is shorter than your response time.
  • They appear together with 502 or 504 errors, which points to an overloaded or unhealthy upstream.

The fix then is the same as for any slow endpoint: find the query or the external call, add a timeout or an index, and move slow work to a background job.

Catch the slowness before users leave

A 499 is a symptom that nobody sees on the other end, so you won't get a complaint until the problem is large. Watching response time from outside shows the trend earlier. A website monitor in Spot Downtime records how long each check takes, and the response-time guide explains what to alert on. If a check itself is hitting your server's slow path, that endpoint is one real users are abandoning as well.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading