← All status codes
504

Gateway Timeout

A proxy or load balancer forwarded your request and gave up waiting for the server behind it to answer.

The proxy's timeout decides when that happens. Nginx's proxy_read_timeout defaults to 60 seconds, as does the AWS ALB idle timeout. Cloudflare doesn't send 504 for this. It returns its own 524 after 125 seconds.

If your client's timeout is shorter than the proxy's, the client gives up first and never sees the 504. That's why monitoring tools often report a timeout where a browser would eventually show a 504.

What we see on Larm

Failed HTTP checks on Larm from 9 October to 8 November 2026, across about 130 monitors.

One monitor got a 504 in this period, 2 failed checks in total. That's far fewer than 502 or 503, and timeouts are the reason. Larm's default check timeout is 10 seconds, shorter than most proxies wait before sending a 504, so a slow app shows up as a timeout first. In the same period, 12,175 checks timed out, on 121 of the roughly 130 HTTP monitors.

COMMON CAUSES

A slow database query
A call to a slow external API with no timeout of its own
The app is deadlocked, or every worker is busy
The proxy timeout is lower than the app's normal response time
The network between the proxy and the app drops packets

HOW TO FIX IT

Find the slow requests with your APM or the database's slow query log
Give outbound calls a timeout that's shorter than the proxy's
Check whether the app's worker pool is saturated
Raise the proxy timeout only after fixing the slow request

What this means for monitoring

Watch response times, not just up or down. A 504 is often the end of a period of rising response times, and Larm's request traces show which phase got slow.

Related status codes

5xx Server Error

Get alerted when your endpoints return unexpected status codes.

Larm checks your HTTP endpoints from multiple global locations and alerts you when they return status codes outside your expected range.