Proxies, Load Balancers & CDNsIntermediate
The report endpoint returns 504 — and the server logs a 200 later
Symptoms
GET /reports/annualreturns504 Gateway Timeoutafter exactly 60 s.- The application log shows the same request completing with 200 about 75 s after it started.
- Users click "retry", which makes everything slower for everyone.
- Small reports work; only the annual report fails.
$ curl -o /dev/null -sw 'code=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' \
https://api.example.com/reports/annual
code=504 connect=0.021s ttfb=60.004s total=60.004s
# load balancer access log
2026-08-25T10:02:14Z ELB 203.0.113.9:51230 10.0.3.14:8080 0.001 60.000 -1 504 "GET /reports/annual"
# client target req target resp status
# time time time
# application log (same request id)
10:02:14.021 INFO req=7f3a start GET /reports/annual
10:03:29.410 INFO req=7f3a done 200 in 75389 ms # nobody is listening anymore
# LB configuration
idle_timeout.timeout_seconds = 60Investigate
Inspect areas in any order (0/6 inspected). When you think you know the root cause, commit to it.
The timing breakdown
The LB access log
The application log
Retries
Is the upstream refusing connections?
DNS / TLS