How to fix 504 gateway timeout error in your websites
In our role as website support specialists, we help website owners resolve all sorts of errors that affect their websites. Commonly encountered errors are related to the web server and the mail server.
One such web server error that occurs in high traffic servers, is the “HTTP Error 504 Gateway Timeout” error. Today, we’ll see what causes it and how to fix 504 gateway timeout error in websites.
What causes 504 gateway timeout error
In web server setup with a proxy server such as NginX in frontend and Apache in the backend, 504 gateway errors can occur when there is a delay in response from one server to the other.
The proxy server gets request from the client via web browser. This proxy server acts as a gateway and sends request to the web server at the backend. If the web server fails to respond on time, it would give an error.
This usually happens when the web server is down or not working properly or due to network connectivity issues. Here, we’ll discuss the various reasons why ‘504 gateway timeout error’ occurs.
- Browser errors – When the web client (such as browser) settings are not properly configured, it can cause connectivity issues to web server.
- DNS issues – Incorrect DNS settings for the domain can cause domain resolution issues, which can cause timeout errors when trying to access it.
- Network connectivity – If the network connection between the proxy server and the web server is poor, it will cause delay in getting response for the HTTP request.
- Slow web server – The backend web server, say Apache, that is fulfilling the request can be too slow due to poor performance or too much traffic. This can lead to gateway errors.
- Firewall blocks – The web server firewall configuration may have some errors or rules, which can prevent the connection from establishing properly and giving out errors.
- Proxy server timeout – If the gateway or proxy server’s timeout duration is too short, there will not be adequate time for the HTTP request to be received and passed on to web client.
[ Worried about your broken websites? Get our server specialists’ assistance to fix your site from all errors. ]
How to fix 504 gateway timeout error
The 504 Gateway Timeout error means that the proxy server is not receiving a response from the webserver within the allowed time period. It is important to identify the actual cause of the error before proceeding to the solution.
First thing we confirm is whether the issue is at the client side or in the server. To check whether it is any end-client issue, we get the customer perform these steps:
- Try loading the website in another browser
- Refreshing/reloading the website or application
- Checking for ISP or local firewall issues
- Trying the URL from a different location
- Restarting the network devices
- Confirming that the proxy server settings in the browser or application are correct
If the issue is not at client side, but in the server, then we examine the web server error logs and get insight into the issue that could be causing the timeout errors.
Some of the major tasks we perform as a part of fixing the 504 gateway timeout error are:
- We check the DNS settings of the website and fix any resolution errors that we detect.
- With the help of network tools such as traceroute, we detect the network connectivity errors and try to resolve them.
- If the web server is under abuse or high traffic, we immediately hop in and bring it back to stable state.
- For slow web servers, we perform web server optimization and parameter tweaking to improve its speed.
- We audit the firewall blocks in the web server and ensure that unwanted blocks are not inhibiting the connections.
- For proxy and web servers, we verify the ‘timeout’ configuration setting and increase it to an adequate value to avoid timeout issues. But increasing the value too much can affect the server performance. In such cases, we improve the server design and other performance parameters to resolve slowness issues.
[ A single misconfiguration may break your site! Click here for a customized and error-free website to help you boost your business. ]
Bobcares helps online businesses of all sizes achieve world-class security and uptime, using tried and tested solutions. If you’d like to know how to make your websites error-free, we’d be happy to talk to you.