Error Codes Wiki

HTTP 504 Gateway Timeout — What It Means & How to Fix It

Critical5xx server error

Overview

The HTTP 504 Gateway Timeout status code indicates a server acting as a gateway or proxy did not receive a timely response from the upstream server.

Key Details

  • Similar to 502, but specifically a timeout issue rather than an invalid response.
  • The upstream server is taking too long to respond.
  • Common with slow database queries, external API calls, or heavy processing.
  • Proxy timeout settings determine how long to wait before returning 504.
  • The request may still be processing on the upstream server.

Common Causes

  • The upstream server is processing the request too slowly.
  • A database query or external API call is taking too long.
  • Network latency between the proxy and upstream server.
  • The upstream server is overloaded and cannot respond within the timeout period.

Steps

  1. 1Retry the request as the upstream server may have been temporarily slow.
  2. 2If you control the server, optimize slow queries or API calls.
  3. 3Increase proxy timeout settings if the backend legitimately needs more time.
  4. 4Check upstream server performance and resource utilization.
  5. 5Consider implementing async processing for long-running operations.

Tags

httpserver-errorgatewaytimeoutproxyperformance

Related Items

More in 5xx Server Error

Frequently Asked Questions

It means a proxy or gateway server did not receive a response from the upstream server within the allowed time period.