Back to Status Codes
Server Error (5xx)

HTTP 504 Gateway Timeout

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

504

Gateway Timeout

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

What Causes HTTP 504?

  • Upstream server took too long to respond
  • Database query timeout exceeded
  • Slow third-party API integration
  • Serverless function cold start delay
  • Network congestion between services

Code Examples

See how HTTP 504 responses look in different programming languages and tools.

curl -X GET https://api.example.com/slow-resource
# Response: 504 Gateway Timeout
# The upstream server did not respond in time

How to Fix HTTP 504

  • Increase timeout values on the proxy or load balancer
  • Optimize slow database queries with proper indexes
  • Implement caching for slow endpoints
  • Move heavy processing to background jobs
  • Use async processing for long-running operations
  • Check your API response times with our API response checker

Related Status Codes

Test Your APIs

Frequently Asked Questions

What does HTTP 504 mean?

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

What causes HTTP 504?

Upstream server took too long to respond. Database query timeout exceeded. Slow third-party API integration. Serverless function cold start delay. Network congestion between services

How to fix HTTP 504?

Increase timeout values on the proxy or load balancer. Optimize slow database queries with proper indexes. Implement caching for slow endpoints. Move heavy processing to background jobs. Use async processing for long-running operations. Check your API response times with our API response checker

http 504gateway timeout errorhttp status codesapi error handlingrest api server error