What is 504 Gateway Timeout Error?

Photo of author

By Sina Nasiri

When you are visiting a website, nothing could be more frustrating than a blank white screen appearing with the 504 Gateway Timeout error message in place of the website content.

In this article, we will first understand what the 504 Gateway Timeout Error signifies, and then we will move on to discuss ways to fix it. When it comes to generating revenue from your websites such as blogs or e-commerce stores, the occurrence of this error can give rise to inferior user experience and significant loss in revenue.

What is the 504 Gateway Timeout Error?

Whenever you visit any website from your web browser, the latter initiates a request and sends it to the webserver that hosts the website. Subsequently, the request is processed by the server. Once the processing is complete, the server sends a response to the browser along with the intended resources.

The response from the webserver takes one of several HTTP status codes into account. These specific status codes are used to denote the status of the response to the web browser. However, it must be borne in mind that all HTTP status codes do not signify errors. As an example, the “200 OK” status code implies successful processing of the request by the server and that “everything is ok”.

It is only the 5XX category of HTTP status codes that means something with the webserver is not right. And, since the web server knows about it, it is unable to execute the request from the clients.

There are 5 different response status codes in the 5XX category, namely 500, 501, 502, 503, 504. Also, you may run into a few unofficial codes like 506, 507, 509, 520, etc.

According to The Internet Engineering Task Force (IETF), the definition of 504 gateway timeout error is put forward as:

“The 504 (Gateway Timeout) status code indicates that the server while acting as a gateway or proxy did not receive a timely response from an upstream server it needed to access to complete the request.”————————–this is a definition. i cant do anything about this.

To further elucidate, this particular error comes into being when two web servers process the same request at the same time. The first server is called the main server. The second server is called the upstream server. The 504 gateway timeout error occurs when the main server is timed out while awaiting a response from the upstream server.

A 504 gateway timeout error has a striking similarity with a 502 bad gateway error that springs up upon the receipt of an invalid response by the main server from the upstream server.

Variations of 504 Gateway Timeout Error

The 504 gateway timeout error makes its appearance in diverse forms. In this section, we will discuss how it manifests differently.

The 504 gateway timeout error is manifested by the web browser similarly to all other errors. As the website operational framework consists of several OSs, web browsers, web servers, and user agents, the error can be made plain in several forms.

Following are the most commonly occurring 504 error messages that you may come across:

  • 504 gateway timeout
  • 504 gateway timeout NGINX
  • NGINX 504 gateway timeout
  • Gateway timeout error
  • Error 504
  • HTTP error 504
  • HTTP error 504 — gateway timeout
  • HTTP 504
  • 504 Error
  • Gateway timeout (504)
  • This page is not working — Domain took too long to respond
  • 504 gateway time-out — The server did not respond in time
  • A blank white screen

Each of the above-mentioned responses, albeit phrased in different ways, alludes to the same 504 gateway timeout error.

For websites and web servers, it is possible to customize the worded expression of the error and show it to users. There are creative ways to put the error in words so that its occurrence does not lead to any disappointment among the users.

Causes of 504 gateway timeout error

Prior to considering the ways to fix the error, the need to understand why this error occurs is important. When you open your web browser and visit a website URL is visited, a request is sent back to the web server that hosts the specific URL.

The request is then processed by the webserver. Following this, the requested resources are transmitted back to you together with an HTTP header. Many HTTP status codes are contained within the header.

The response status code allows you to understand whether the request has been processed correctly or if something has gone wrong. Every status code does not indicate anything bad. For instance, the 200 status code means everything is working fine.

As mentioned previously, all 500 status codes such as 500, 501, 502, 503, 504, etc. indicate erroneous events. Each of them has different connotations. These error codes signify that the request you made was sent and accepted by the webserver but the latter could not process it.

By that token, the HTTP 504 error refers to a situation where the web server assumes the role of a gateway but fails to perform its function by going out of time while waiting to evoke a response.

The error is sent back when two such servers are involved in simultaneously handling the request. In the meanwhile, an expiry of the response time occurs as prompted by the second server.

Apart from servers experiencing timeouts, other causes resulting in the generation of 504 error code include the following:

  • Slow server

There is always a likelihood of the server hosting a WordPress-built website to respond in an excessively slow manner. So, it gives rise to the generation of gateway errors.

  • Inadequate PHP workers

The function of PHP workers is to run code in your WordPress-built site. Websites that carry heavy traffic can trigger the possibility of all PHP workers going busy. Consequently, a queue of PHP workers develops. In case the queue is too long and the backlog is not recompensed in totality, the old requests are disregarded.

How to resolve this issue? Well, you demand more PHP workers from your hosting service provider. When a website is assigned with an extra PHP worker, several requests are executed at the same time.

  • Problems with the firewall

There may be errors residing in the firewall of your web server. These errors happen because of inaccurate configuration or malfunctioning rules. This causes a blockage in the connection.

  • Network connection

During certain times a network connection problem can arise between the web server and proxy server. This, in turn, can bring about delays. Plus, occasionally load balancers, if used, may cause network problems.

Impact of 504 Gateway Timeout Error on SEO

By now, it is known that any 5XX errors do not allow a web page to load. This is hurtful to the website’s repute as far as user experience (UX) is concerned.

Therefore, these errors are looked at very seriously by major search engines such as Google. Also, if the error hangs around for a prolonged period you may even find the website or the particular web page being de-indexed from Google’s search engine result pages (SERPs).

As an instance, upon stumbling across a 503 service unavailable error, Google web crawlers comprehend it as a temporary problem as the error is most frequently used to activate a website maintenance mode. So, they will come back to the page later and try to load it again.

In contrast, the 504 gateway timeout error is not an essentially temporary issue because of many reasons. For example, when your website is down for very little time, the web crawlers will try to access it several times during the short-lived outage. If they find it inaccessible they will try serving a certain web page of the site from their cache. The site down period does not even come to their notice.

However, if your website is non-functional for more than 6 hours, then Google will identify the occurrence of the 504 error as a serious problem persisting all through the website. Under such a circumstance you need to resolve the outage very soon and make the site up and running. Or else, your website’s ranking and its SEO will be adversely impacted.

Google Search Console happens to be one of the most effective SEO implements that can continuously keep an eye on the origination of any HTTP 5XX errors.

Ways to Fix HTTP 504 Gateway Timeout Error

As you come across a 504 gateway timeout error code, you may find it confusing as to how to fix the problem. You can make efforts in resolving the problem by following different ways that are mentioned ahead:

1. Try reloading the page

This is one of the first and foremost things to do when you receive the 504 gateway timeout error. You can wait for one minute after the manifestation of the error and attempt to load the web page again. It may so happen that the web server or hosting is overloaded for that while. Odds are that the site will resume quickly.

There is a particular website that goes by the name of downforeveryoneorjustme.com. You can visit this website to check the status of your website. This website assists by informing you if your website is inaccessible to just you or all of your visitors. A built-in tool in the website checks the specific HTTP status code sent back by the webserver. In case the code is anything but 200, the tool will show the Down pointer. So, you can very well understand that your website is down for everyone.

2. Use a different browser and check

If your website is online, yet, you still run into the 504 error code, you can try accessing it from some other browser. Also, you can try clearing the cache of your browser or access the website using the incognito mode. This will help ascertain if your web browser is the culprit that has caused the 504 error.

3. Confirm the error on different devices

You can try visiting your website from different computers and mobile devices, and try using different networks. If you have not been able to fix the 504 gateway timeout error and restore your website, this method will perhaps come in handy for determining if the problem is a local one or is at the server-side.

4. Try disabling the proxy server

Occasionally, the presence of a proxy server may lead to the occurrence of the 504 gateway timeout error. So, what you simply need to do is to disable the proxy server and check if you can access the website or not. However, such occurrences are seldom found as far as the client-side is concerned.

5. Take a look at the propagation of DNS records

Every so often, the HTTP 504 gateway timeout error happens because of problems related to the DNS server. These problems can occur because of the following two reasons:

  • Reason 1

It occurs on the server-side when the IP address in the domain name is not changed correctly during the time a WordPress website is newly hosted. In case you have just switched your website over to a new hosting, you must wait till the time the IP address is included in the DNS base. In the majority of cases, it takes a maximum of 24 hours for the change to be made effective.

Each DNS record has a time to live (TTL) value. The time for the change to happen depends on this TTL value. You can make use of DNSMap – a free tool that checks whether there is a spread of your DNS all through the world.

  • Reason 2

The second DNS problem is found to occur on the client-side. The problem can be resolved by clearing the cache of your local DNS, much like how you clear the cache of your web browser.

Ultimately, there is the workaround by which your DNS servers on the client-side can be temporarily altered. As a rule, your Internet Service Provider (ISP) provides the DNS servers. For the time being, you can modify them from a private setting to a public setting. You can use them as DNS servers; the ones offered by Google. Since the public DNS servers provided by Google are very reliable, many people prefer to put them to use.

6. Try disabling the CDN temporarily

The emergence of the 504 gateway timeout error may also happen because of issues faced in the content delivery network (CDN). In the event you have a third-party CDN, the best thing you can do is to disable it for some time. To do that, you may take recourse to WordPress plug-ins. They can safely inactivate the CDN.

Firewall providers such as Sucuri or Cloudflare provide proxy services. If you use them, ensure that they are functioning correctly. Sometimes, the 504 error code may be invoked because of the additional firewalls used by them. Nearly all these firewalls put all 500 error codes in their cache when the errors are sent back by your webserver. Several users have encountered this issue with the free plan offered by Cloudflare. But due to the reason that Cloudflare is a comprehensive proxy service, it cannot be quickly discontinued from offering service.

7. Keep a watch on the themes and plug-ins you use

Most users believe that themes or plug-ins from a third party cannot cause the 504 error. This is apparently true in the majority of cases. However, as per the feedback received concerning user experience, delays can be caused by slow uncached plug-in requests.

This is because they use more PHP workers. After the threshold is reached, the queue is found to eliminate your old requests. This can result in the generation of 504 gateway timeout errors.

You can adopt many ways to resolve the problem. Firstly, you can get each of your plug-ins deactivated. Keep in mind that a plug-in deactivation does not erase any data. If the overall deactivation rectifies the issue you need to identify the rogue plug-in.

This can be accomplished by one-by-one activating the plug-ins. If at any instant the 504 error reappears you can find out the rogue plug-in then and there. Next, you can get in touch with the plug-in developer for support, replacement, and resolution.

Also, ensure all the themes, plug-ins, and WordPress kernel that you use are updated with the most recent version.

You must clean your website from bots, spam, and offer a safeguard against DDoS attacks It may so happen that your website is struck down with spamming by bots. Also, its safety is jeopardized by a potential DDoS attack. Occasionally, such events can result in the formation of uncached requests.

Consequently, your webserver gets overloaded and the 504 gateway timeout error, in turn, comes into being. You can familiarize yourself with server analytics to figure out specific patterns in the occurrence of the error. The hosting provider you have teamed up with can give you this information.

You can study the following reports to get to the bottom of the problem:

  • A report on the IP addresses of high-end customers
  • A report on the occurrence of requests and bots
  • A report on cache analysis

If any problematic IP address needs to be blocked, a separate WordPress security plug-in may be used. But, not every hosting provider allows the installation of such security plug-ins.

Firstly, security plug-ins can negatively impact your website’s performance when they carry out extensive scanning. Secondly, the feature to block IP addresses may not be effective as hosting providers usually utilize the functionality of load balancers derived from the Google Cloud Platform.

Needless to say, any hosting support can block rogue IP addresses. But, depending on the duration and magnitude of the DDoS attack, the blocking trend enters into a never-ending cycle. Spam or attacks can rapidly move from one IP address to another. So, if you block one, chances are the attacks switch to a different IP address or proxies. Such problems can be eliminated through the installation of a robust security solution like Sucuri or Cloudflare.

8. Try to find out any problems with your hosting service provider

Most commonly you may find your server creating problems and generating the 504 gateway timeout error.

504 errors crop up very frequently on extremely popular websites with plenty of users visiting them. Even they have widespread occurrences on e-commerce websites. For example, an e-commerce plug-in such as WooCommerce houses several uncached requests.

This can lead to overloading of the server. But, the 504 error is found to take place in many other website types like blogs other than e-commerce. Lots of hosting service providers suggest their customers upgrade to a costlier premium plan to fix this problem.

Some hosting services come up with dedicated resources meant for each server. This implies every website is hosted in a unique separate container. Each container possesses all essential software resources such Linux, PHP, Nginx, and MySQL to run the website. However, a few plans of shared WordPress hosting do not offer this feature. Therefore, any adjacent website with enormous traffic flow may induce errors in your site.

With the help of tools such as statuscake.com, it is possible to keep such errors at bay. The tool constantly monitors the state of the server. It reports any abnormality at once.


So, it is evident that there are several corrective methods and ways to get rid of the HTTP 504 gateway timeout error. By and large, the problem is caused on the server-side. In such scenarios, the only thing you can do is contact your hosting service provider to solve it. However, it is important to keep in mind that the time queuing or backlog of your PHP workers or third-party plug-ins can lead to the genesis of the 504 error.

If you recurrently come across the HTTP 504 gateway timeout error and none of the methods described above can rectify it, you must get in touch with the technical support team of your hosting service provider. Make sure you provide them the maximum possible information to expedite the resolution.

People are also reading: 

Leave a Comment