HTTP 504 Gateway Timeout

Plain-English meaning

A gateway timed out waiting for upstream response.

Why it happens

Upstream processing exceeded timeout budgets configured on gateway/CDN/load balancer.

Common causes

  • Slow database queries
  • Upstream worker deadlocks
  • Network latency between edge and origin
  • Mismatched timeout values across layers

What to check first

Compare p95/p99 response times with gateway timeout settings and trace where latency is introduced.

How to fix it

Optimize slow operations, align timeout budgets end-to-end, and move long jobs to async workflows.

Example signal

upstream timed out (110: Connection timed out) while reading response header

Related links

404 · 429 · 500 · 502 · 503 · 504 · Cloudflare 522 · Nginx 499 · ERR_CONNECTION_REFUSED

Client errors hub · Server errors hub · Comparison pages · Homepage