Nginx / Envoy · HTTP 504

Nginx 504: Upstream Gateway Timeout

Trace Nginx 504 to an upstream that fails to connect or return headers before proxy timeouts. Inspect application latency, queues, and dependencies.

Origin / Application

Decode a CDN or gateway error

Paste a captured HTTP response or enter a status and headers. Only the status and response headers are sent; common credential headers are filtered first.

Supports raw headers, full HTTP responses, JSON with status/statusCode and headers, cURL -v/-i response output, and HAR exports. HAR selects a server error first. cURL commands are never executed; request headers, response bodies, and common credential headers are excluded.

Diagnostic report

Error code / name

NGINX-504

Fault domain

Origin / Application

Why it happened

Nginx did not receive a timely upstream response. The connection may be slow to establish, or the application may be blocked on a worker, database, or downstream service.

Actionable fixes

  1. Use the Nginx request ID and upstream timing fields to distinguish connect delay from response delay.
  2. Trace application, database, and dependency spans for work that exceeds the configured request budget.
  3. Tune proxy timeouts only after confirming the workload is expected and downstream limits allow it.

Why this error happened

Nginx did not receive a timely upstream response. The connection may be slow to establish, or the application may be blocked on a worker, database, or downstream service.

Actionable fixes

  1. Use the Nginx request ID and upstream timing fields to distinguish connect delay from response delay.
  2. Trace application, database, and dependency spans for work that exceeds the configured request budget.
  3. Tune proxy timeouts only after confirming the workload is expected and downstream limits allow it.

Network failure point

Client -> Nginx -> upstream receives request -> no response before proxy_read_timeout -> X 504

Verify origin directly via CLI

curl -sS -I -w 'connect=%{time_connect} starttransfer=%{time_starttransfer} total=%{time_total}\n' --max-time 90 https://example.com/health

Configuration fix

nginx.confnginx
location /api/ {
    proxy_connect_timeout 3s;
    proxy_send_timeout 30s;
    proxy_read_timeout 30s;
    proxy_pass http://app;
}

Catch this failure before it becomes an outage

SteadyNode tracks time-to-first-byte and gateway status from outside the origin, exposing latency trends before proxy_read_timeout produces repeated 504 errors.

No credit card required.

Start for free

Frequently asked questions

What does Nginx proxy_read_timeout measure?

It limits the time between successive reads from the upstream. It is not a general application execution-time guarantee.

Should I increase proxy_read_timeout for every 504?

No. Measure the upstream first; use a larger timeout only for expected long responses and keep client and dependency limits aligned.

Cloudflare

Vercel and Netlify

AWS CloudFront and ALB

Fastly

Heroku and Render

Nginx and Envoy