---
title: "Fix the HTTP 499 error and find out who stopped waiting"
description: "HTTP 499 is the status nginx logs when the client closes the connection before the response. The client never sees it, and in our test the upstream finished every request."
canonical: "https://logbrew.co/en/errors/http-499"
last_updated: "2026-11-21"
---

# Fix the HTTP 499 error and find out who stopped waiting

HTTP 499 is the status nginx logs when the client closes the connection before the response. The client never sees it, and in our test the upstream finished every request.

Tested on November 21, 2026 with nginx 1.31.8, curl 8.7.1, Python 3.13.5, and logbrew CLI 0.1.96

By [Furkan Erday](https://github.com/furkanerday). Furkan Erday is the founder of LogBrew. He builds LogBrew with Claude Code and Codex every day.

Canonical: https://logbrew.co/en/errors/http-499

## Who stopped waiting, and what nginx logged

| Who stopped waiting | Client got a response | Logged `499` |
| --- | --- | --- |
| Nobody, the upstream answered in 0.2 s | `200` | `200` |
| The client, after 2 s | No | `499` |
| The client, after 0.3 s | No | `499` |
| nginx, after `proxy_read_timeout 3s` | `504` | `504` |
| The client, nginx kept waiting | No | `200` |

5 requests through nginx 1.31.8, sent by curl 8.7.1. The last ran with `proxy_ignore_client_abort on`.

## Find out who stopped waiting

### Find the 499 lines in the access log

nginx writes `499` to the access log, and only there. In the default `combined` format the line shows the request and 0 bytes sent, but not how long anyone waited.

Output

```text
127.0.0.1 - - [21/Nov/2026:17:09:07 +0300] "GET /api/report?delay=5 HTTP/1.1" 499 0 "-" "curl/8.7.1"
127.0.0.1 - - [21/Nov/2026:17:09:08 +0300] "GET /api/report?delay=1 HTTP/1.1" 499 0 "-" "curl/8.7.1"
```

### Log how long each side waited

Add `$request_time`, `$upstream_status`, and `$upstream_response_time` to a `log_format` in the `http` block, beside your default log. Then run `nginx -s reload`.

```bash
log_format timing '$remote_addr "$request" $status $body_bytes_sent '
                  'request_time=$request_time '
                  'upstream_status=$upstream_status '
                  'upstream_response_time=$upstream_response_time';
access_log /var/log/nginx/timing.log timing;
```

### Read request_time on each 499 line

`request_time` is how long the client waited before it hung up. Our clients gave up after 2 s and after 0.3 s, and nginx logged 2.006 and 0.301. `upstream_status` is `-` because the upstream had not answered yet.

Output

```text
127.0.0.1 "GET /api/report?delay=5 HTTP/1.1" 499 0 request_time=2.006 upstream_status=- upstream_response_time=2.006
127.0.0.1 "GET /api/report?delay=1 HTTP/1.1" 499 0 request_time=0.301 upstream_status=- upstream_response_time=0.301
```

### Look for 1 value that repeats

Many 499 lines with nearly the same `request_time` point to a fixed timeout in front of nginx, such as the client's own. 3 clients with `--max-time 2` gave 3 lines at 2.008 to 2.011 s. Compare that value with `upstream_response_time` on the 200 lines of the same path. If the upstream often needs longer, it is too slow for that client.

Output

```text
127.0.0.1 "GET /api/report?delay=4 HTTP/1.1" 499 0 request_time=2.011 upstream_status=- upstream_response_time=2.011
127.0.0.1 "GET /api/report?delay=4 HTTP/1.1" 499 0 request_time=2.011 upstream_status=- upstream_response_time=2.012
127.0.0.1 "GET /api/report?delay=4 HTTP/1.1" 499 0 request_time=2.008 upstream_status=- upstream_response_time=2.007
```

### Tell 499 apart from 504

When nginx stops waiting first, it logs `504`, and the client gets a 504 page. `request_time` is then your `proxy_read_timeout`, 3 s in our test, and `upstream_status` is `504`, not `-`. The error log says `upstream timed out`.

Output

```text
127.0.0.1 "GET /short/report?delay=5 HTTP/1.1" 504 167 request_time=3.001 upstream_status=504 upstream_response_time=3.001
2026/11/21 17:09:11 [error] 61151#0: *35 upstream timed out (60: Operation timed out) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /short/report?delay=5 HTTP/1.1", upstream: "http://127.0.0.1:28500/api/report?delay=5", host: "127.0.0.1:28499"
```

## Fix it

### Make the upstream answer before the client gives up

If the 499 lines share 1 `request_time` and the 200 lines of that path take longer, speed up that endpoint or raise the timeout in the client. A short `request_time`, like our 0.301, means the client cancelled the request itself, for example when a user leaves the page.

### Stop work that nobody waits for

Our upstream logged 200 for both requests that nginx logged as 499. It finished them 3 s and 0.7 s after the client left. nginx closed its upstream connection, but the upstream did not notice. Check for a closed connection in long handlers, or move slow work to a background job.

Output

```text
14:09:05.796 upstream got /api/report?delay=5
14:09:07.822 upstream got /api/report?delay=1
14:09:08.827 upstream answered 200 after 1.0s
14:09:10.802 upstream answered 200 after 5.0s
```

### Keep proxy_ignore_client_abort off

With `proxy_ignore_client_abort on`, nginx waited for the upstream and logged `200` with a `request_time` of 5.006, though curl had hung up after 2 s. The 499 was gone from the log. `off` is the default.

```bash
proxy_ignore_client_abort off;
```

Output

```text
127.0.0.1 "GET /keep/report?delay=5 HTTP/1.1" 200 12 request_time=5.006 upstream_status=200 upstream_response_time=5.006
```

### Send the 499 lines to LogBrew

LogBrew has no nginx integration, but it takes OTLP logs. This command sends each 499 and 504 line as 1 log. Set `LOGBREW_INGEST_KEY` to a `server` key of your project. Our local LogBrew API answered `{}`, so it took every line.

```bash
grep -E '" (499|504) ' /var/log/nginx/timing.log |
  jq -Rn '{resourceLogs: [{resource: {attributes: [{key: "service.name", value: {stringValue: "nginx"}}]}, scopeLogs: [{logRecords: [inputs | {severityText: "WARN", body: {stringValue: .}}]}]}]}' |
  curl -sS https://api.logbrew.co/v1/logs -H "x-logbrew-key: $LOGBREW_INGEST_KEY" \
    -H 'Content-Type: application/json' --data-binary @-
```

Output

```text
{}
```

### Search them with the LogBrew CLI

Each line is 1 log with the level `warning`, and its message is the whole line. Put spaces around 499 in the search, so a 499 inside a path or a time does not match.

```bash
logbrew read logs --project "<project_id>" --service nginx --search ' 499 ' --since 1h
```

Output

```text
Logs (2)
- warning 127.0.0.1 "GET /api/report?delay=1 HTTP/1.1" 499 0 request_time=0.301 upstream_status=- upstream_response_time=0.301 service=nginx trace=3ded5398edda96df764625b26d6274f2 [unversioned / production]
- warning 127.0.0.1 "GET /api/report?delay=5 HTTP/1.1" 499 0 request_time=2.006 upstream_status=- upstream_response_time=2.006 service=nginx trace=4ad4df7e9d1f37c7dc182a77a1e83012 [unversioned / production]
```

## What we saw when we tested it

We ran nginx 1.31.8 on macOS 27.2 at `127.0.0.1:28499`, in front of a Python 3.13 upstream that waits the seconds in `?delay=` and then answers 200. curl 8.7.1 sent 5 requests, 3 of them with `--max-time`.

In both 499 lines, `request_time` matched the curl timeout within 6 ms, and `upstream_status` was `-`. In the 504 line, it matched `proxy_read_timeout`, and `upstream_status` was `504`.

|  | `$status` | `$request_time` | `$upstream_status` |
| --- | --- | --- | --- |
| Nobody gave up | `200` | 0.206 sec | `200` |
| The client gave up after 2 s | `499` | 2.006 sec | `-` |
| The client gave up after 0.3 s | `499` | 0.301 sec | `-` |
| nginx gave up after 3 s | `504` | 3.001 sec | `504` |
| The client gave up, nginx kept waiting | `200` | 5.006 sec | `200` |

## Why only nginx sees 499

499 is not an HTTP status code. RFC 9110 defines the 4xx codes, and 499 is not one of them. nginx defines it in `src/http/ngx_http_request.h` as `NGX_HTTP_CLIENT_CLOSED_REQUEST`, for a client that closed the connection before nginx sent the response header.

The client never gets a 499, because its connection is already closed. nginx closes the upstream connection too, and writes `499` to the access log.

At the default error log level, `error`, nginx writes nothing else about a 499. At the level `info` it writes `client prematurely closed connection`. A 504 shows at the level `error`.

1. The client closes the connection
2. nginx closes the upstream connection
3. nginx writes 499 to the access log

## What LogBrew records

LogBrew stored each line we sent as 1 log of the `nginx` service, with the level `warning`. It keeps the whole line as the message and does not split it into fields, so search the text.

The dashboard, the CLI, and the MCP server read these logs like any other LogBrew log.

- `nginx`
  - `level`: `warning`
  - Message: `… 499 0 request_time=0.301 …`
  - `trace`: `3ded5398edda96df764625b26d6274f2`

## Questions people ask

### What does HTTP status code 499 mean?

The client closed the connection before nginx sent the response, and nginx logged 499. The status is not part of HTTP, and the client never receives it.

### Is a 499 error caused by the client or the server?

The client closes the connection, but a slow upstream is often why. Compare `request_time` on the 499 lines with `upstream_response_time` on the 200 lines of the same path.

### What is the difference between 499 and 504?

499 means the client stopped waiting first. 504 means nginx stopped waiting first, after `proxy_read_timeout`, and the client gets the 504.

### How do I fix 499 errors in nginx?

Find the client's timeout in `request_time`, then make the upstream answer before it, or raise that timeout. `proxy_ignore_client_abort on` only hides the 499 in the log.

### Does the upstream know that the client left?

Not in our test. Our Python upstream logged 200 for both requests that nginx logged as 499, and finished each one after the client was gone.

## Search every 499 line in 1 place

Send your nginx log lines to LogBrew as OTLP logs, and search them from the dashboard, the CLI, or your AI agent. Start on the generous free tier, no card needed.

[Start Free](https://logbrew.co/en)

## Sources

- [RFC 9110, HTTP Semantics, 15.5 Client Error 4xx](https://www.rfc-editor.org/rfc/rfc9110#section-15.5)
- [MDN, 504 Gateway Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/504)
- [LogBrew docs, Send OpenTelemetry data to LogBrew with OTLP](https://docs.logbrew.co/guides/opentelemetry)
- [LogBrewCo/docs, guides/opentelemetry.mdx](https://github.com/LogBrewCo/docs/blob/main/guides/opentelemetry.mdx)

## More error fixes

- [Fix the script error that hides its message, file, and line](https://logbrew.co/en/errors/script-error)
- [Fix the Failed to fetch error and tell its 3 causes apart](https://logbrew.co/en/errors/failed-to-fetch)
- [Fix java.lang.NullPointerException in Kotlin and Android from its message](https://logbrew.co/en/errors/nullpointerexception)
- [Fix Minified React error #418 and #185 from the full message and your source line](https://logbrew.co/en/errors/minified-react-error)
- [Fix SyntaxError Cannot use import statement outside a module in the browser and in Node.js](https://logbrew.co/en/errors/cannot-use-import-statement-outside-a-module)
- [Fix AxiosError Network Error and find which of its 3 causes you have](https://logbrew.co/en/errors/axios-network-error)
- [JavaScript errors and JVM exceptions we reproduced, and how to fix each one](https://logbrew.co/en/errors)
