Skip to main content
SiteIndex

5xx Server Error

504 Gateway Timeout

A gateway or proxy did not get a response from the upstream server in time.

Check a URL's HTTP status

What it means

The origin is reachable but too slow, often because of long-running queries or overloaded servers.

Common causes

  • Slow database queries or API calls.
  • Proxy timeout set lower than the app's response time.
  • Network problems between the proxy and origin.

How to fix it

  1. Optimize slow requests or move them to background jobs.
  2. Align proxy and application timeouts.
  3. Check origin server load.

Example response

HTTP/1.1 504 Gateway Timeout
Content-Type: text/plain; charset=utf-8

Worked example

A gateway or server cannot complete an otherwise valid request. Check the origin service and proxy logs, correct the server-side cause, then retry after the service is healthy.

How to read this response

  1. Find the status line in your browser's Network panel, API client, or server access log.
  2. Read the response body and headers shown above; headers such as Location, Allow, Retry-After, and WWW-Authenticate explain the next step.
  3. Use the code's class to orient your diagnosis: informational, successful, redirected, request-related, or server-side.

How to check a status code

Enter a URL in the HTTP Status Checker to see its status code, every redirect hop, and response time. For redirect-heavy pages, the Website Speed Test shows how much time redirects add.

Frequently asked questions

What it means: HTTP 504
504 Gateway Timeout: A gateway or proxy did not get a response from the upstream server in time.
Common causes: 504
Slow database queries or API calls. Proxy timeout set lower than the app's response time. Network problems between the proxy and origin.
How to fix it: HTTP 504
Optimize slow requests or move them to background jobs. Align proxy and application timeouts. Check origin server load.

Defined in RFC 9110.

Related codes

Tools