The server was acting as a gateway or proxy and did not get a response from the upstream server in time. The backend took too long to respond.
A load balancer waits for a response from your API server, but a complex database query takes longer than the 60-second timeout.
504 Gateway Timeout means your backend took too long to respond. If Googlebot hits consistent 504s, it reduces crawl frequency and can cause ranking drops.
Optimize slow database queries and add query timeouts. Increase proxy timeout settings. Add caching for expensive operations. Use APM tools (Datadog, New Relic) to identify the slowest endpoints.
Check how any URL responds in real time