499 Client Closed Request

The client closed the connection before the server had finished responding.

Last updated . How this page is checked.

Status code499
Status textClient Closed Request
Category4xx Client Error
Response has bodyUsually
Defined bynginx (not an IANA-registered code)

What does 499 Client Closed Request mean?

The client closed the connection before the server had finished responding. It is numbered in the 4xx Client Error range but is not a registered HTTP status code, so the general meaning of that class is only a rough guide to it.

When do APIs return 499?

Only in server logs. Nginx writes 499 to its access log when the caller hangs up while nginx is still waiting for the application behind it. The client never receives this code, because it is no longer listening. The usual causes are a client-side timeout shorter than the time the backend takes, a user who navigated away or pressed stop, and a load balancer or health checker in front of nginx giving up first.

How to fix a 499 Client Closed Request

Treat it as a slow-response problem, not a client problem. Compare the request time logged beside each 499 with the timeout of whatever calls nginx: if they cluster at a round number such as 30 or 60 seconds, that timeout is firing. Make the backend faster, raise the caller's timeout, or move long work to a background job that answers 202 straight away. Note that the backend may have carried on and completed the work after the client left, so a retried write can run twice.

Reproduce a 499 response

The fastest way to understand a status code is to trigger one and read the full response. Open the API tester and send a request to https://httpbin.org/status/499 — you will see the 499 status along with every response header the server sent. Comparing those headers against a working request is often what reveals the cause.

That response only imitates the number, which is useful for checking how your own client, alerting or retry logic treats a 499. A real one comes from the software named in the table above, in the circumstances this page describes.

When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.

Related 4xx status codes

499 Client Closed Request FAQ

Is 499 an official HTTP status code?

No. It is an nginx convention that is not in the IANA registry. Nginx records it in its access log for a request the client abandoned, and it is never sent over the network, since the client has already gone.

What is the difference between 499 and 504?

They are the same slow request seen from two sides. 499 means the client gave up waiting first. 504 Gateway Timeout means the proxy gave up waiting for the server behind it first. Which one you get depends on whose timeout is shorter.

Did the server still process a request logged as 499?

Possibly. By default nginx closes its connection to the backend when the client disconnects, but the application may already have done the work or may carry on regardless. Check the result before retrying anything that is not idempotent.

See also

  • 408 Request Timeout — The server timed out waiting for the client to finish sending the request.
  • 504 Gateway Timeout — A gateway or proxy did not receive a timely response from the upstream server.

References