Runs in your browser. Your files and text never leave your device - nothing is uploaded.
5xx Server Error
What it means
A server acting as a gateway or proxy didn't receive a timely response from the upstream server.
| Property | Detail |
|---|---|
| Status class | 5xx Server Error |
| Defined in | RFC 9110, Section 15.6.5 |
| Cacheable by default | Only with explicit caching headers: a cache stores it when the response carries Cache-Control (max-age, s-maxage or public) or Expires. |
| Who needs to act | The site owner, who has to speed up the upstream or adjust timeouts. |
What does HTTP 504 Gateway Timeout mean?
HTTP 504 Gateway Timeout means a server acting as a gateway or proxy did not receive a timely response from the upstream server it needed to complete the request. The proxy stopped waiting, usually after its configured timeout. The upstream may still be working on the request, so the action may or may not have happened.
How 504 Gateway Timeout works
A 504 is a disagreement about time. The proxy, whether nginx, a cloud load balancer or a CDN, has a limit on how long it will wait for the upstream, and the upstream exceeded it. nginx's proxy_read_timeout defaults to 60 seconds, and nginx logs 'upstream timed out (110: Connection timed out) while reading response header from upstream' when it fires. Raising the timeout hides the symptom; the durable fix is making the slow operation faster or moving it into a background job. Because the upstream may finish the work after the proxy gives up, blindly retrying a POST can perform the action twice.
Example 504 request and response
GET /reports/annual HTTP/1.1
Host: app.example.com
HTTP/1.1 504 Gateway Timeout
Server: nginx
Content-Type: text/htmlnginx waited for the report to render, hit its read timeout and gave up; the report may still be generating behind it.
What causes a 504 Gateway Timeout
- Slow database queries, missing indexes or locked tables.
- A slow third-party API that the application waits on synchronously.
- Long-running work, such as reports or imports, done inside the request.
- Proxy or load balancer timeouts shorter than the application's real response time.
- Network or DNS problems between the proxy and the upstream server.
How to fix a 504 Gateway Timeout
If you are a visitor
- Retry after a short wait, but check before resubmitting a payment or order.
- If one page always times out, report it; it is a performance problem on the server.
If you run the site
- Find the slow upstream call with application performance monitoring or slow-query logs.
- Move long-running work to a background job and return 202 Accepted.
- Align timeouts across the proxy, load balancer, application server and database.
- Raise proxy_read_timeout only for routes that genuinely need longer.
504 and SEO
Google handles 504 like other server errors: crawling slows down, and URLs that keep timing out can be removed from the index. Pages that sometimes time out for Googlebot are usually slow for real visitors too.
Related status codes
- 502 Bad Gateway: The upstream answered badly or refused the connection, rather than answering too slowly.
- 408 Request Timeout: The client was too slow sending the request: the opposite direction.
- 503 Service Unavailable: The service is deliberately unavailable rather than slow.
Tools that help
- DNS Lookup checks that the upstream hostname resolves to the address you expect.
Frequently asked questions
A server acting as a gateway or proxy didn't receive a timely response from the upstream server.
A slow backend server, database query, or network issue between the proxy and the origin server.
Retry the request. If you run the server, check for slow backend processes or database queries, and consider increasing the proxy's timeout.
Possibly. The proxy stopped waiting, but the upstream server may have finished the work afterwards. Check the result, such as your order history or account balance, before retrying anything that changes data.
Sources
Other 5xx Server Error codes
Reviewed by Raja Jahangir · Last reviewed: October 7, 2026
