Server Error (5xx)

HTTP 504 โ€” 504 Gateway Timeout

The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.

Common Causes & Diagnoses
  • โ€ขSlow database query running longer than proxy_read_timeout (usually 60s).
Spesifikasyon & Kategori
Status Code:504
Category:Server Error (5xx)
RFC Standard:RFC 9110 / HTTP/1.1 & HTTP/2
Multi-Language Code Implementations

How to Handle, Return & Test HTTP 504

Status: 504 504 Gateway Timeout
server.js / handler.ts
// Express.js Server Response
app.get('/api/resource', (req, res) => {
  // Returning 504 504 Gateway Timeout
  return res.status(504).json({
    error: '504 Gateway Timeout',
    statusCode: 504,
    timestamp: new Date().toISOString()
  });
});

// Client-side fetch error check
const response = await fetch('/api/resource');
if (response.status === 504) {
  console.warn('Received HTTP 504 504 Gateway Timeout');
}
๐Ÿ’ก Pro Tip: Ensure appropriate error handling middleware or proxy interceptors are enabled so client applications receive structured JSON responses for HTTP 504.
How to Fix / Practical Code Solutions

Increase Nginx Proxy Timeout

Adjust timeout settings in nginx.conf for long-running endpoints.

proxy_read_timeout 300;
proxy_connect_timeout 300;
Other Popular HTTP Status Codes
Frequently Asked Questions

Common Questions About HTTP 504 to RFC Standard

Everything you need to know regarding specifications, syntax, and security best practices.

The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server. In Turkish: Nginx veya Cloudflare proxy, arka plandaki sunucudan zamanฤฑnda yanฤฑt alamadฤฑ.