504 Gateway Timeout: The server was acting as a gateway and did not receive a timely response from upstream. 504 Gateway Timeout means a proxy or load balancer waited for your application and gave up. The application was reachable but took too long to answer. The usual cause is a slow request: a heavy database query, a call to an external API that hangs, or a report generated during the request. The proxy's timeout, often 30 or 60 seconds, runs out first.
Frequently asked questions about 504 Gateway Timeout
What should you keep in mind with 504 Gateway Timeout?
Raising the timeout hides the problem but rarely solves it. Find out what is slow, using logs or a profiler. Add a missing index, cache the result, or move the work to a background job that notifies the user when it is done. Calls to external services should always have their own, shorter timeout, so one slow partner cannot take down your whole application.
Use when an HTTP request returns an unexpected status code (4xx or 5xx, or a redirect loop), when a user pastes an error like "419 Page Expired", "422 Unprocessable Content", "502 Bad Gateway" or "CORS error", or when debugging API calls between a frontend and a Laravel/PHP or Node backend. Finds the cause from the status code, headers and logs before changing code.
Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.