All status codes

5xx Server errors

504 Gateway Timeout

A proxy, load balancer or CDN waited too long for the server behind it.

Common causes

  • A slow database query or external API call.
  • The app is overloaded and responds too slowly.
  • A timeout in the proxy shorter than the work takes.

How to fix it

  • Find the slow part: database queries, external calls, heavy pages.
  • Move long jobs to a background queue.
  • Raise the proxy's timeout only if the slowness is expected.

Find out the moment your site returns 504

Spot Downtime monitors count this as down and alert you, since visitors see an error. (The public “Is it down?” checker treats 4xx answers from big sites as online, because many refuse automated requests.)