---
title: "Risolvi l’errore HTTP 499 e scopri chi ha smesso di aspettare"
description: "HTTP 499 è lo stato che nginx registra quando il client chiude la connessione prima della risposta. Il client non lo vede mai, e nel nostro test l’upstream ha completato ogni richiesta."
canonical: "https://logbrew.co/it/errors/http-499"
last_updated: "2026-11-21"
---

# Risolvi l’errore HTTP 499 e scopri chi ha smesso di aspettare

HTTP 499 è lo stato che nginx registra quando il client chiude la connessione prima della risposta. Il client non lo vede mai, e nel nostro test l’upstream ha completato ogni richiesta.

Testato il 21 novembre 2026 con nginx 1.31.8, curl 8.7.1, Python 3.13.5 e logbrew CLI 0.1.96

Di [Furkan Erday](https://github.com/furkanerday). Furkan Erday è il fondatore di LogBrew. Sviluppa LogBrew ogni giorno con Claude Code e Codex.

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

## Chi ha smesso di aspettare, e cosa ha registrato nginx

| Chi ha smesso di aspettare | Il client ha ricevuto risposta | Registrato `499` |
| --- | --- | --- |
| Nessuno, l’upstream ha risposto in 0,2 s | `200` | `200` |
| Il client, dopo 2 s | No | `499` |
| Il client, dopo 0,3 s | No | `499` |
| nginx, dopo `proxy_read_timeout 3s` | `504` | `504` |
| Il client, nginx ha continuato ad aspettare | No | `200` |

5 richieste attraverso nginx 1.31.8, inviate con curl 8.7.1. Nell’ultima era attivo `proxy_ignore_client_abort on`.

## Scopri chi ha smesso di aspettare

### Trova le righe 499 nell’access log

nginx scrive `499` nell’access log, e solo lì. Nel formato predefinito `combined` la riga mostra la richiesta e 0 byte inviati, ma non quanto ha aspettato ciascuno.

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"
```

### Registra quanto ha aspettato ogni lato

Aggiungi `$request_time`, `$upstream_status` e `$upstream_response_time` a un `log_format` nel blocco `http`, accanto al tuo log predefinito. Poi esegui `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;
```

### Leggi request_time su ogni riga 499

`request_time` è quanto ha aspettato il client prima di chiudere. I nostri client hanno rinunciato dopo 2 s e dopo 0,3 s, e nginx ha registrato 2,006 e 0,301. `upstream_status` è `-` perché l’upstream non aveva ancora risposto.

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
```

### Cerca 1 valore che si ripete

Molte righe 499 con quasi lo stesso `request_time` indicano un timeout fisso davanti a nginx, per esempio quello del client stesso. 3 client con `--max-time 2` hanno dato 3 righe tra 2,008 e 2,011 s. Confronta quel valore con `upstream_response_time` sulle righe 200 dello stesso percorso. Se l’upstream ci mette spesso di più, è troppo lento per quel 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
```

### Distingui 499 da 504

Quando è nginx a smettere di aspettare per primo, registra `504` e il client riceve una pagina 504. Allora `request_time` è il tuo `proxy_read_timeout`, 3 s nel nostro test, e `upstream_status` è `504`, non `-`. Il log degli errori riporta `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"
```

## Risolvi

### Fai rispondere l’upstream prima che il client rinunci

Se le righe 499 hanno lo stesso `request_time` e le righe 200 di quel percorso durano di più, velocizza quell’endpoint o alza il timeout nel client. Un `request_time` breve, come il nostro 0,301, vuol dire che il client ha annullato la richiesta da solo, per esempio quando l’utente lascia la pagina.

### Ferma il lavoro che nessuno aspetta

Il nostro upstream ha registrato 200 per entrambe le richieste che nginx ha registrato come 499. Le ha completate 3 s e 0,7 s dopo che il client se n’era andato. nginx ha chiuso la connessione con l’upstream, ma l’upstream non se n’è accorto. Controlla se la connessione è chiusa negli handler lunghi, o sposta il lavoro lento in un job in background.

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
```

### Lascia proxy_ignore_client_abort disattivato

Con `proxy_ignore_client_abort on`, nginx ha aspettato l’upstream e ha registrato `200` con un `request_time` di 5,006, anche se curl aveva chiuso dopo 2 s. Il 499 era sparito dal log. `off` è il valore predefinito.

```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
```

### Invia le righe 499 a LogBrew

LogBrew non ha un’integrazione per nginx, ma accetta log OTLP. Questo comando invia ogni riga 499 e 504 come 1 log. Imposta `LOGBREW_INGEST_KEY` su una chiave `server` del tuo progetto. La nostra API LogBrew locale ha risposto `{}`, quindi ha accettato ogni riga.

```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
{}
```

### Cercale con la CLI di LogBrew

Ogni riga è 1 log con il livello `warning`, e il suo messaggio è la riga intera. Metti degli spazi intorno a 499 nella ricerca, così non trovi un 499 dentro un percorso o un orario.

```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]
```

## Cosa abbiamo visto nel test

Abbiamo eseguito nginx 1.31.8 su macOS 27.2 a `127.0.0.1:28499`, davanti a un upstream in Python 3.13 che aspetta i secondi indicati in `?delay=` e poi risponde 200. curl 8.7.1 ha inviato 5 richieste, 3 delle quali con `--max-time`.

In entrambe le righe 499, `request_time` coincideva con il timeout di curl entro 6 ms, e `upstream_status` era `-`. Nella riga 504 coincideva con `proxy_read_timeout`, e `upstream_status` era `504`.

|  | `$status` | `$request_time` | `$upstream_status` |
| --- | --- | --- | --- |
| Nessuno ha rinunciato | `200` | 0,206 s | `200` |
| Il client ha rinunciato dopo 2 s | `499` | 2,006 s | `-` |
| Il client ha rinunciato dopo 0,3 s | `499` | 0,301 s | `-` |
| nginx ha rinunciato dopo 3 s | `504` | 3,001 s | `504` |
| Il client ha rinunciato, nginx ha continuato ad aspettare | `200` | 5,006 s | `200` |

## Perché solo nginx vede il 499

499 non è un codice di stato HTTP. La RFC 9110 definisce i codici 4xx, e 499 non è tra questi. nginx lo definisce in `src/http/ngx_http_request.h` come `NGX_HTTP_CLIENT_CLOSED_REQUEST`, per un client che ha chiuso la connessione prima che nginx inviasse l’header della risposta.

Il client non riceve mai un 499, perché la sua connessione è già chiusa. nginx chiude anche la connessione con l’upstream e scrive `499` nell’access log.

Al livello predefinito del log degli errori, `error`, nginx non scrive nient’altro su un 499. Al livello `info` scrive `client prematurely closed connection`. Un 504 compare al livello `error`.

1. Il client chiude la connessione
2. nginx chiude la connessione con l’upstream
3. nginx scrive 499 nell’access log

## Cosa registra LogBrew

LogBrew ha salvato ogni riga inviata come 1 log del servizio `nginx`, con il livello `warning`. Tiene la riga intera come messaggio e non la divide in campi, quindi cerca nel testo.

La dashboard, la CLI e il server MCP leggono questi log come qualsiasi altro log di LogBrew.

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

## Domande frequenti

### Cosa significa il codice di stato HTTP 499?

Il client ha chiuso la connessione prima che nginx inviasse la risposta, e nginx ha registrato 499. Lo stato non fa parte di HTTP, e il client non lo riceve mai.

### Un errore 499 dipende dal client o dal server?

È il client a chiudere la connessione, ma spesso il motivo è un upstream lento. Confronta `request_time` sulle righe 499 con `upstream_response_time` sulle righe 200 dello stesso percorso.

### Che differenza c’è tra 499 e 504?

499 vuol dire che il client ha smesso di aspettare per primo. 504 vuol dire che nginx ha smesso di aspettare per primo, dopo `proxy_read_timeout`, e il client riceve il 504.

### Come risolvo gli errori 499 in nginx?

Trova il timeout del client in `request_time`, poi fai rispondere l’upstream prima, o alza quel timeout. `proxy_ignore_client_abort on` nasconde solo il 499 nel log.

### L’upstream sa che il client se n’è andato?

Nel nostro test no. Il nostro upstream in Python ha registrato 200 per entrambe le richieste che nginx ha registrato come 499, e le ha completate quando il client non c’era più.

## Cerca ogni riga 499 in 1 solo posto

Invia le righe di log di nginx a LogBrew come log OTLP e cercale dalla dashboard, dalla CLI o dal tuo agente IA. Inizia con il generoso piano gratuito, senza carta.

[Inizia gratis](https://logbrew.co/it)

## Fonti

- [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)

## Altre soluzioni agli errori

- [Risolvi l’errore di script che nasconde messaggio, file e riga](https://logbrew.co/it/errors/script-error)
- [Risolvi l’errore Failed to fetch e distingui le sue 3 cause](https://logbrew.co/it/errors/failed-to-fetch)
- [Risolvi java.lang.NullPointerException in Kotlin e Android partendo dal messaggio](https://logbrew.co/it/errors/nullpointerexception)
- [Risolvi l’errore Minified React #418 e #185 con il messaggio completo e la tua riga di codice](https://logbrew.co/it/errors/minified-react-error)
- [Risolvi Cannot use import statement outside a module nel browser e in Node.js](https://logbrew.co/it/errors/cannot-use-import-statement-outside-a-module)
- [Risolvi l’errore di rete AxiosError e scopri quale delle 3 cause hai](https://logbrew.co/it/errors/axios-network-error)
- [Errori che abbiamo riprodotto, e come risolvere ciascuno](https://logbrew.co/it/errors)
