Why does the 504 Gateway Time Out error occur and how to fix it?

Why does the 504 Gateway Time Out error occur and how to fix it?

09:34, 25.01.2023

Article Content
arrow

  • Error 504 variants
  • Causes of 504 Gateway Time Out
  • Ways to solve the 504 error problem for the website administrator
  • To summarize

When trying to load a web page the server may display a 504 Gateway Time Out error. If you see this code on the screen, it means that the waiting time limit has been exceeded due to technical problems. It occurs if the server does not receive a response after a set period of time – because of this, it can not load the requested page. In this article, we will tell you what the possible causes of error 504 and what solutions can be found.

Error 504 variants

The most common forms of this message:

  • 504 Error.
  • "Server response time has expired."
  • HTTP Error 504.
  • "Gateway timeout error."
  • Gateway timeout.
  • The server didn't respond in time.

The variant of the text will depend on the web-server in use. Most often it is Nginx and Apache. In any case this error indicates the same problems.

Causes of 504 Gateway Time Out

The most common scenario is an excessive workload on the server, which prevents it from processing all incoming requests in a timely manner. DDoS-attacks or natural overflow of visitors may provoke an error if the current configuration of the server can not cope with the load. In this case, it is recommended to migrate the site to a more powerful dedicated server or VPS with more RAM and more powerful processor cores.

In addition to the load, there may be other reasons for the appearance of 504 Gateway Time Out:

  1. Plugin errors. When a large number of plugins and extensions are installed on the server, some of them can conflict with each other. Or there can be "crooked" plugins that don't work properly. Some plugins download data from third-party sources, and if the requested server is unavailable, visitors will get a 504 error.
  2. Non-optimized scripts. To fully load the site page requires that all the scripts are loaded. If any of them fails to load within the specified time, it will also cause an error.
  3. Overspending on the limits of the hosting plan. Not all hosters offer unlimited traffic to their customers, and in the case of overspending the available capacity is severely underestimated, resulting in a noticeable decrease in server performance.
  4. Injection of malicious code into site files. Miners, Trojans and other threats can significantly increase the load on the server, thereby provoking the server response time.
  5. Browser error. Disabled JavaScript or cache errors can also provoke a 504 response code.

Let's look at what are the ways of solving the problem.

why does the 504 gateway time out error occur and how to fix it?

Ways to solve the 504 error problem for the website administrator

If a website is displaying a 504 Gateway Time Out error, there are a number of actions that can help resolve the problem as quickly as possible:

  1. Close and reopen the browser, then reload the web page. Alternatively, you can also try loading the same page from another browser. If the error persists – then the problem is on the server side.
  2. Disable all plugins and retest. If the problem disappears – then it provokes one of the plugins or extensions. You should connect them one by one and check if the site remains functional. Repeat until the problem plugin is detected.
  3. Clear the browser cache and delete cookies. In principle, you should do this without any problems for preventive purposes, at least once every couple of months. In rare cases, the cache of errors can lead to situations where the page stops loading.
  4. Go to a more powerful VPS or dedicated server. This should be done if the excessive waiting time occurs for natural reasons due to increased traffic. If the reason is DDoS-attacks, it is necessary to take measures to protect the server. We have a separate article on this topic.
  5. Clean the DNS cache. This is an achievable task for almost any administrator. The algorithm of the actions depends on the OS you have installed on the server. It is not difficult to find a suitable manual.
  6. Reset the router or modem settings. Disconnect the equipment from the network for a while. If the cause is in the router, the error will disappear.

You can also try to temporarily switch the DNS-server to Google Public DNS. At the very least, this will allow you to understand what is causing the 504 error, whether DNS is the root of the problem, or whether it is something else.

To summarize

If you're having trouble resolving an error on your website, contact the experts at HostZealot through Livechat. We will help to solve any issue within our competence. Have a nice day!

views 3m, 41s
views 2
Share

Was this article helpful to you?

VPS popular offers

Other articles on this topic

How to modify hosts file
How to modify hosts file
cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.