504 Gateway Timeout — Causes & Fix
HTTP 504 (Gateway Timeout) means a gateway/proxy server timed out waiting for a response from the upstream (origin) server.
- Applies to
- Any website or web server (HTTP standard)
- Time to fix
- 15 minutes – 2 hours
What it means
Causes include a slow or overloaded backend, a long database query, or network problems between proxy and origin. This is a server-side (5xx) error defined in RFC 9110 (HTTP Semantics) — the request was valid, so the fix is on the server/origin side, not the visitor's.
Symptoms
- "504 Gateway Timeout"
- Requests hang, then fail after a delay
How to fix it
- 1
As a visitor
1. Retry shortly — the backend may just be slow or briefly overloaded.
- 2
As the operator
1. Speed up the slow backend/query and increase relevant timeouts. 2. Check connectivity between the proxy/CDN and the origin.
Frequently asked questions
502 vs 504?
502 = the proxy got an invalid response from the backend; 504 = the proxy got no response in time (the backend was too slow). Both point to the origin server.
Last updated July 20, 2026
Guidance only — always consult a qualified professional or the official service manual before carrying out repairs.