A 504 gateway timeout error is a type of server error – meaning that the server accepted your HTTP request (A request message from a client to a server) but an error prevented the completion of the request. There are numerous reasons as to why it happened in the first place. So, let us take a look at some of the potential solutions to help fix a 504 gateway timeout error.
504 Gateway Timeout Error: Explained
In case you are curious to know what it is, we will give you a brief idea about it here.
The 504 Gateway Timeout error occurs when the server returns an HTTP status code (a numeric code acting as a message to the browser telling what happened on the server-side when the resource request was received) of 504 in the HTTP header.
A 504 error code is a type of server error which occurs in the scenario where one server (which acts as a gateway) depends on another server to fulfill its request. And, if the second server (on which the first is dependent on) does not respond, the request by the first server times out and a 504 error code is generated.
Note: Depending on whether you’re a visitor or the webmaster, the solutions have been categorized.
How To Fix A 504 Gateway Timeout If You Are A Website User/Visitor
1. Refresh The Web page
Most of the time, the 504 gateway timeout errors are temporary (maybe the server was too busy or not responding at that very particular time). So, you need to reload the webpage by pressing Shift + F5 simply.
2. Restart The Router
You can try restarting the router and then check back again to see if the web page loads up.
3. Use Another DNS Server
By default, your ISP sets the DNS servers that you utilize. However, you can explicitly change the DNS servers and utilize a good DNS service (like Cloudflare’s privacy-focused DNS, Google Public DNS, Cisco’s OpenDNS) to ensure that you have all the updated DNS records.
Personally, I would recommend you to change your DNS servers to get an edge over the default DNS servers (refer to the image below to get an idea of how DNS servers affect your browsing experience).
For example, here’s how you would set the DNS servers to Cloudflare’s 18.104.22.168 DNS service (official guide for Windows):
Similarly, you can refer to the official guide of several DNS services – if you plan to change the DNS servers of your network.
If the issue persists, even after changing the DNS servers, then it might be a server-side issue which you do not need to worry about. You could inform the webmaster of the affected website – if you get an option to contact them (or happen to find their contact details on the Internet).
How To Fix A 504 Gateway Timeout If You Are A Webmaster
If you are a webmaster, there are a lot of things that you can do to fix the 504 gateway timeout error. Let us take a look at some of the fixes.
1. DNS Propagation Problem
If you have recently changed your DNS settings for your domain, you should wait for a few hours for the DNS records to propagate.
You can use a DNS Propagation checker like WhatsMyDNS.net to know the status of your DNS. If it is alright (one/two failed lookups is considerable), you should get going and try the solutions mentioned below. If most of the DNS lookups failed, you should wait for it to propagate.
2. Check If Your Server’s Too Busy
In some cases, the server fails to handle the request simply because of extreme utilization of resources – that usually happens when your website receives heavy traffic or maybe a DDoS attack. If that is the case, you should consider upgrading your hosting plan or coordinate with your hosting provider to pinpoint the reason for high resource utilization.
3. Disable Your CDN (If any)
If you are using a content delivery network (like KeyCDN, Cloudflare, MaxCDN) to improve your website’s load time (and performance), you can try disabling it to see if it resolves the error.
4. Possible Database Corruption
If you have WordPress installed, a corrupted database might be the root of showing up the 504 gateway timeout error. So, in that case, you can install a plugin (like WP-DBManager) and repair/optimize the database to see if that helps.
5. Double-check The HTACCESS file
The .HTACCESS file is a configuration file addressed to the servers running on Apache Web server software. If you did not modify the htaccess file, then something else is probably causing the 504 gateway timeout error. But, still, just in case, check if the file is correct.
You can even customize the 504 error page with the help of htaccess file. To learn more about how htaccess files work and what it’s all about, you should read Digital Ocean’s tutorial to understand the usage of the .htaccess file.
If none of the solutions mentioned-above work (considering you are a website visitor), you can just wait for it to get resolved from the server-end. In either case, if you are a webmaster and you have been encountering the 504 gateway timeout error on your site, you should be able to resolve the issue with the solutions mentioned above – just in case – if nothing works, you need to get in touch with your hosting provider for technical assistance.
Were you able to resolve the issue? If not, did you try a workaround that we did not know yet? Let us know your thoughts in the comments below.
Filed in Internet.. Read more about