504
Gateway Timeout
5xx Server error
Class
RFC 9110 §15.6.5
Defined in
What does HTTP 504 mean?
A gateway or proxy did not get a response from the upstream server in time. The application is reachable but too slow: the proxy gives up after its timeout (60 s by default in Nginx proxy_read_timeout; 100 s at Cloudflare; 10–60 s on serverless platforms).
5xx Server error: The request looked valid, but the server failed to fulfil it. The fix is on the server side.
Common causes of a 504 error
- Slow database queries or external API calls.
- Long-running requests such as reports or imports done synchronously.
- Serverless function time limits.
How to fix 504 Gateway Timeout
- Optimise slow queries and add caching.
- Move long tasks to background jobs and return 202.
- Raise proxy timeouts only as a last resort.
504 and SEO
Slow responses hurt Core Web Vitals and crawling; persistent 504s cause deindexing like other 5xx errors.
Example response
HTTP/1.1 504 Gateway Timeout
Related status codes
- 502 Bad Gateway — A gateway or proxy got an invalid response from the upstream server.
- 503 Service Unavailable — The server is temporarily unable to handle the request.
- 408 Request Timeout — The server timed out waiting for the client to send the request.
- 524 A Timeout Occurred — Cloudflare connected to the origin, but it did not send a response within 100 seconds.
Check which status code a URL returns with the HTTP header checker.
All HTTP status codesSearch the full list of status codes from 100 to 599 with their meanings and SEO impact.
Open the full list Frequently asked questions
What does status code 504 mean?
504 Gateway Timeout: A gateway or proxy did not get a response from the upstream server in time.
How do I fix a 504 error?
Optimise slow queries and add caching. Move long tasks to background jobs and return 202.
Does 504 affect SEO?
Slow responses hurt Core Web Vitals and crawling; persistent 504s cause deindexing like other 5xx errors.