HTTP 504 Gateway Timeout — Upstream Server Slow
About HTTP 504 Gateway Timeout
HTTP 504 Gateway Timeout means the gateway did not receive a timely response from the upstream server. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Status: 504 Gateway Timeout. Category: 5xx Server Error. Upstream server did not respond in time. Proxy/gateway gave up waiting. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Backend server is too slow to respond. Database query taking too long. Upstream server is overloaded. Network issues between proxy and backend. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Wait and retry — the backend may be temporarily overloaded. Check backend server performance. Optimize slow database queries. Increase proxy timeout settings if appropriate. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
504 vs 408?
504 is gateway-to-upstream timeout. 408 is client-to-server timeout.
Overview
HTTP 504 Gateway Timeout means the gateway did not receive a timely response from the upstream server.
Key Details
- Status: 504 Gateway Timeout
- Category: 5xx Server Error
- Upstream server did not respond in time
- Proxy/gateway gave up waiting
Common Causes
- Backend server is too slow to respond
- Database query taking too long
- Upstream server is overloaded
- Network issues between proxy and backend
Steps
- 1Wait and retry — the backend may be temporarily overloaded
- 2Check backend server performance
- 3Optimize slow database queries
- 4Increase proxy timeout settings if appropriate