5xx Server error
504 Gateway Timeout
A gateway or proxy didn’t get a response from the upstream server in time.
The application is reachable but too slow: the proxy’s timeout (often 60 seconds) expired first.
Common causes and fixes
- Find the slow part: database queries, external API calls, or long LLM generations.
- Increase proxy timeouts (e.g. nginx
proxy_read_timeout) only if the work genuinely takes long. - Move long tasks to a background job (return 202) or stream the response so data starts flowing early.
Example response
HTTP/1.1 504 Gateway Timeout
Date: Thu, 22 Oct 2026 08:00:00 GMT Check a URL’s status with curl -I https://example.com, which prints the status line and headers.