How to Fix HTTP 504 Gateway Timeout Error?

There is nothing more annoying than a blank screen with an error message instead of your website’s content. Today, we’ll take a look at the 504 Gateway Timeout Error, and also give some recommendations on how to fix it on your WordPress site. For most blogs and online stores, such errors can lead to a loss of revenue. The visitors immediately leave the resource with a bad experience, and cannot make purchases. So let’s dive in –

How to Fix the HTTP 504 Gateway Timeout Error?

Fixes of the HTTP 504 Gateway Timeout Error
Fixes of the HTTP 504 Gateway Timeout Error

When you see a 504 Gateway timeout error, you might be confused about what to do. You can always try the following actions –

1. Try To Reload The Page

One of the first things you should do when you face the HTTP Error 504 Gateway Timeout is just to wait a minute and reload the page. Perhaps the hosting or server is simply overloaded, and the site will quickly return to work.

Another thing you can do is check your website status on This site will tell you if the site is out of service only for you or for all visitors. The tool checks the HTTP status code that is returned by the server. If the code differs from 200, then, in this case, you will see the Down pointer. It will mean that the site does not work for everyone.

2. Try A Different Browser

In case the site is online, but you still see the HTTP Error 504 Gateway Timeout, try changing your browser to another one. Clear the browser cache or use the incognito mode, this can also help determine if the error is caused by the browser.

3. Check On Different Devices

Try opening the site on different computers, different networks, or on mobile devices. If nothing could help to fix the Error 504 gateway timeout, this step will help you determine if the problem is on the server side or if it is local.

4. Disable The Proxy Server

Disable the proxy server in Windows PC
Disable the proxy serverin Windows PC

Sometimes you may get an HTTP 504 error if you use a proxy server. These cases are very rare, especially on the client side. Read the guides on how to disable proxy on Windows and Mac.

For Windows users

Step 1: Go to your Chrome browser and click on the menu button “” located at the top right corner and select “Settings”.

Step 2: Now scroll down and select the “system” section followed by “Open Proxy settings“.

Step 3: If you are a Windows 10 user or above it, this will open a separate proxy settings window.

Step 4: In the proxy settings window you will find two sections, Automatic proxy setup, and Manual proxy Setup.

Under Automatic Proxy Setup, Turn off: Automatically detect settings (Toggle button) and Use setup script (click on Set up > Turn off > Save)

Under Manual Proxy Setup, Turn off: Use a Proxy Server (Click on Setup button> Turn off > Save)

Under Manual Proxy Setup, Turn off: Use a Proxy Server (Click on Setup button> Turn off > Save)

For Mac Users, they can do the following steps to disable proxy settings:

Step 1: Go to the Apple menu or click on the apple icon located at the top left of your Mac screen.

Step 2: Click on System Settings or System Preferences, whichever is applicable.

Step 3: Now click on the “Network” in the sidebar.

Step 4: From the right pane, Select a network service > click the Advanced button.

Step 5: Click on the Proxy tab and uncheck all the protocols under “Select a protocol to configure” and click on the “Ok” button when done.

5. Check DNS Record Propagation

DNS propagation check
DNS propagation check

HTTP Error 504 gateway timeout is often caused by problems with the DNS server. There are two reasons for that. On the server side, it happens when the domain name is not changed to the correct IP address. If you just moved the WordPress website to a new hosting, it’s important to wait until the address is added to the DNS base. In most cases, it takes up to 24 hours. It all depends on your DNS records’ TTL value. You can use a free tool like DNSMap to check if your DNS has spread all over the world.

The second DNS issue relates to the client side. In this case, you can clear your local DNS cache. This is similar to clearing the browser cache.

In Windows, simply open a command line and type the following:

ipconfig / flushdns

Flush DNS in ipconfig
Flush DNS in ipconfig

You should see the “Successfully flushed the DNS Resolver Cache” message.

In macOS, type the following in the terminal:

dscacheutil -flushcache

Note: there are no messages of successful operations on Mac.

And, finally, you can temporarily change your client’s DNS servers. By default, DNS servers are provided by your ISP. You can temporarily change them to a public DNS server, for example, provided by Google. Some people prefer to use Google’s public DNS constantly because in some cases they are more reliable.

6. Temporarily Disable The CDN

Also, the problem may relate to the content delivery network. If you use a third-party CDN provider, you can try to temporarily disable it. For that, you may use WordPress plugins. With them, you will be able to disable the CDN safer.

If you use back proxy services like Cloudflare or Sucuri, they may cause the 504 gateway timeout error as they use the additional firewall. Most of the cache 500 state codes are returned by your source server. Many users noticed that issue on Cloudflare’s free plan. Unfortunately, since Cloudflare is a complete proxy service, there is no quick way to disconnect it.

However, before blaming Cloudflare, it is important to know that there are two types of 504 gateway timeout errors:

504 Gateway Timeout in Cloudflare (version 1)

504 status code
504 status code

If you see the page looking like that, then, in this case, the problem is on the Cloudflare side. Contact their user support. Or check their status page. Most likely, they are already notified about this problem and are working on it.

504 Gateway Timeout in Cloudflare (version 2)

504 Gateway Timeout in Cloudflare
HTTP status 504 error

If you see the page looking like that, then this is a problem with your WordPress hosting. Please follow the recommendations from the next section.

7. Check The Issue With Your Hosting Provider

Server problems are one of the common reasons why users experience 504 errors on their WordPress websites. In simple terms, Nginx or Apache waits for a response until the waiting time has expired.

504 errors are very popular on sites with a lot of visitors e-commerce sites and online stores. The latter may have installed e-commerce plugins like Woocommerce. They usually have many non-cached requests. This can cause the server to overload. However, such errors can happen to a variety of website types, including blogs. Many hosts usually offer to upgrade to a more expensive tariff plan to fix this problem. And even if this usually helps to solve this issue, it is often not necessary.

Some hosting provides dedicated resources for each server. This means that each site is hosted in its isolated container. It has all the necessary software resources required to run it (Linux, Nginx, PHP, MySQL). Resources are 100% confidential and do not share with anyone. However, some shared WordPress hosting plans do not have this feature. So any neighboring site with high traffic will cause an error 504 gateway timeout on your site.

Note: HTTP 504 errors may look very similar to 503 errors (service unavailable) or even 502 errors (bad gateway). But actually, they are different, to know more you can also check out our post on “15 Best Methods to Fix 502 Bad Gateway Error“.

If you want to prevent such errors in the future, you can use a tool like to track the server state and immediately report any problems. The service periodically sends an HTTP HEAD request to the specified URL. You can simply set your homepage. In addition, you can choose the checking frequency from 15 seconds to 10 minutes.

The service will send you an email if your site is out of service, indicating the time when it happened.

http error code 504
Tracking server state using status cake tracker tool

This can be especially useful if you are using virtual hosting, which, as a rule, is constantly overloaded. This will give you proof that your site did not work (for example, at night). For this reason, we advise you to move on to dedicated hosting.

8. Clean The Site From Spam And Bots And Protect it From DDoS Attacks

Perhaps your website has been spammed by bots or become a DDoS attack target. Sometimes this leads to uncached requests and, as a result, to server overload. All that results in an HTTP error 504 gateway timeout. You can learn the server analytics to see if there are any patterns in it. You can request your hosting provider for this information.

The first report, which we recommend studying, is the top-end customer’s IP addresses. Usually, this is very useful, especially if your site suddenly begins to generate large traffic or is attacked by bots.

The second report we recommend looking at is the requests and bots. You can quickly compare the number of people visiting your website, with the number of bots. However, remember that not all bots are bad. Google Bot is a good bot, it scans the site to index the content and promote it in the search engine.

The third report we recommend is a cache analysis. Here you can see what requests are missing in the cache, and also what are the top locations of your site. To provide the best performance and stability, you should try to cache as many requests as possible. This is not always available because some resources generate a huge amount of uncached requests. The best example is WooCommerce. These requests are necessary for the correct work and synchronization.

If on your site you find and identify traffic or IP addresses that need to be blocked, you can use the WordPress security plugin. However, not all hostings allow you to install security plugins. First, such plugins can influence performance, especially when they scan the server. Second, the IP blocking feature may not work in them because the hosting provider can use load balancers from the Google Cloud Platform.

Naturally, IP addresses can always be blocked by the hosting support service. However, depending on how long and large is an attack, this can never end. When the attacks or spam is blocked in one area, they are often switched to other zones, changing IP addresses or using other proxies. Therefore, in this case, we recommend installing a security solution, such as Cloudflare or Sucuri.

Too many 504 Gateway issues

9. Check Your Plugins And Themes

Many users believe that third-party plugins or themes do not lead to 504 gateway timeout errors. And in most cases this is true. But, according to many users’ experience, a slow non-cached plugin request can cause delays, since it uses more of your PHP workers.

Once you reach the limit of them, the queue will remove your old requests, which can cause HTTP 504 errors. They should not be confused with 502 errors which are the result of a 60-second timeout.

There are several ways to fix the issue. One of them is the deactivation of all your plugins. Remember that you will not lose your data if you disable them. If you have access to the admin panel, simply go to the Plugins section and select the Deactivate feature. This will disable all of your plugins.

If this fixes the issue, you need to find its source. Activate the plugins one by one, restarting the site after each activation. Once you see the HTTP 504 error, you will be able to identify the problematic plugin. Then you can contact the plugin developer for help or create a ticket in the WordPress repository.

If you do not have access to the admin panel, you can use the FTP client to connect to your server. Rename the plugin folder to something like plugins_old. Then check your site again. If this works, you will need to test each plugin separately to find the reason. Rename the plugins folder back. Then rename the plugin folders inside until you find the plugin causing the issue.

Make sure that all your plugins, themes, and WordPress kernels are updated to the latest version. Make sure that you are using a supported version of PHP.

If the plugin contains bad code, then you will most likely need to contact the WordPress developers to solve this problem.

10. Check The Logs

You can also use your error logs. One can view them in a special section of the hosting dashboard. You can quickly fix the issue, especially if its source is the website plugin. If your hosting does not offer logging tools, you can add the following code to the wp-config.php file to enable logging:

define ('WP_DEBUG', true);
define ('WP_DEBUG_LOG', true);
define ('WP_DEBUG_DISPLAY', false);

Logs are usually located in the/wp-content folder. Sometimes they can be in separate folders. You can also check the Apache and Nginx logs which are most often located at /var/log/apache2/error.log (Apache) or /var/log/nginx/error.log (Nginx)

11. Change Nginx Options

If you are maintaining your server and WordPress website on Nginx+FastCGI (php-fpm). Also, you can use Nginx as a proxy for Apache. In that case, there are additional settings that you can change to prevent 504 gateway timeout errors.

If you are using Nginx with FastCGI (php-fpm), then you need to first make changes to the PHP-FPM file. Go to /etc/php5/fpm/pool.d/www.conf (it can vary depending on the PHP version). Set the following directive:

request_terminate_timeout = 300

Then you must modify the php.ini file, which is usually located at /etc/php.ini. Find the max_execution_time directive. Increase its value to 300 or create a directive if it does not exist:

max_execution_time = 300

Finally, you will need to modify the nginx.conf file. Add the following to your Nginx virtual host configuration:

location ~ .php $ {
... fastcgi_read_timeout 300;

Then just restart Nginx and PHP-FPM.

service nginx reload
service php5-fpm reload

If you use Nginx as a proxy for Apache, then in this case add the following to your nginx.conf file:

proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;

Next, just restart Nginx.

service nginx reload

12. Contact Support

If you constantly face an HTTP 504 gateway timeout error and nothing helps to fix it, contact the hosting technical support. Try to describe what steps you have taken to identify the error cause and provide as much information as possible. This will greatly speed up the process.

What is the 504 Gateway Timeout Error?

HTTP status codes starting with 5 are server-side errors. They appear when the request cannot be performed due to a connection failure between several servers.

What does 504 gateway timeout mean? 504 Gateway timeout error is an HTTP status code. It appears when one server does not receive a timely response from another one that works as a gateway or proxy. Simply put, 504 gateway timeout means that the server could not complete your request within some period.

There are many WordPress error messages that you might have experienced on your website. You can also check out some of the lists of the most common WordPress errors and their solution.

As there are a variety of web browsers, operating systems, and types of servers, they display the 504 error in many ways. All of them, as a rule, mean the same. We listed some of the most popular versions of HTTP error 504:

  • 504 Gateway Timeout
  • 504 Gateway Timeout NGINX
  • NGINX 504 Gateway Timeout
  • Gateway Timeout Error
  • 504 gateway timeout PHP
  • Error 504
  • 504 Error Code
  • 504 Status Code
  • HTTP Error 504
  • Gateway Timeout Error 504
  • HTTP 504
  • 504 Error
  • Gateway Timeout (504)
  • 504 Gateway Time-out – The server didn’t respond in time

What Are The Causes of the 504 Gateway Timeout Error?

Causes of the 504 Gateway Timeout Error
Causes of the HTTP 504 Gateway Timeout Error

Before we consider the error itself, it is important to understand why it appears. Whenever you start your browser and visit a URL, it sends the request back to the server where it is hosted. The web server then processes the request and sends you the requested resources along with an HTTP header. This header contains one of the many HTTP status codes that let you understand whether everything is okay or something went wrong. Not all status codes are bad. For example, the status code 200 indicates that everything works fine.

Any status code in the 500-s is an error code (500, 501, 502, 503, 504, etc.) that has different meanings. They indicated that the request was accepted, but the server could not execute it.

To that extent, the HTTP 504 error means that the server running as a gateway is out of time to wait for a server response. The code is returned when there are two servers involved in processing the request, and the response time from the second server has expired.

In addition to server timeouts, there are other causes, leading to the 504 error code:

  • Slow server- It is possible that the server where you host your WordPress website is responding too slowly, and therefore it generates gateway errors.
  • Insufficient PHP workers- PHP workers are used to running code on your WordPress site. Demanding sites can make all PHP workers busy. In that case, they form the queue. If the queue and the backlog are full, old requests are ignored. You can ask your hosting to increase the number of PHP workers. Additional PHP workers for a site allow the execution of several requests simultaneously.
  • Problems with the firewall- The firewall on your server may contain errors due to incorrect configuration or rules blocking the connection.
  • Network connection- If there is a problem with the network connection between the proxy server and the web server, this can lead to delays. Also, there may be network problems with the load balancer, if it is used.


As you can see, there are many different ways and methods to fix HTTP 504 gateway timeout errors on the WordPress site. Typically, this is a problem with the server, and in this case, you need to contact your hosting to solve them. But it’s important to remember that they can also be caused by third-party plugins or your PHP workers’ queue/backlog overflow. You can learn more about HTTP Status Codes by reading online.

Read: 🚩 Managed WordPress Hosting vs VPS


From the above post, you have come across how your WordPress site is quite vulnerable to experiencing 504 Gateway timeout due to various reasons. And in this post, you have also learned multiple working methods to resolve the issue quickly.

Generally, these kinds of errors or issues are generated from the server end itself, and for that, it is highly recommended to contact your web host to fix the issue ASAP.

Apart from server issues, you must also consider that the 504 gateway timeout error can also be triggered due to faulty third-party plugins, themes, databases, etc. In that case, you must check out all the possible reasons and then work on them.

In case, you find your website is still facing timeout issues and no method worked to fix it. It is highly advisable you must migrate your website to a more reliable and trustful Managed web host.

If we missed anything to mention in this post or if you would like to share your opinions about the 504 Gateway timeout error, feel free to write in the comment section below.

Eliminate the risk of “504 Gateway timeout error” by choosing a more reliable and fastest server. Host or migrate your website on WPOven’s Fully managed dedicated servers and enjoy the best in the industry unmatchable features such as,

  • Fastest Private servers
  • Upto 100% uptime monitoring
  • Antimalware scanning
  • 24X7 WordPress Expert support
  • Cloudflare integration
  • High-end Security
  • Datacentres around the world, etc.

You can have all these features and much more in a single plan with unlimited Free migrations, unlimited staging, and a 14-day risk-free guarantee, Signup Now!

Frequently Asked Questions

What causes a 504 Gateway Timeout?

The possible causes that trigger a 504 Gateway Timeout error are:
1. Slow server speed
2. Insufficient PHP workers
3. Problems with the Firewalls
4. Network Connection

How do I fix a 504 Gateway Timeout?

You can easily fix a 504 Gateway timeout error by following these simple methods:
1. Try to reload the page
2. Try a different browser
3. Check on different devices
4. Disable the proxy
5. Check DNS records propagation
6. Temporarily disable the CDN
7. Check the issues with your hosting provider
8. Clean the site from spam, bots and protect it from DDoS attacks
9. Check your plugins and themes
10. Check the logs
11. Change Nginx options

Is a 504 Gateway Timeout my fault?

The error 504 Gateway timeout happens due to the fault from the server side. Generally, requests sent from the clients are good but due to some issue at the server, sometimes they are unable to generate the requested resource. In simple words, this error simply means that your web server didn’t get any response from another server on time while accessing the webpage.

3 Replies to “How to Fix HTTP 504 Gateway Timeout Error?”

  1. Useful information. Lucky me I discovered your web site unintentionally, and I’m stunned why this
    twist of fate didn’t happened in advance! I bookmarked

  2. Thank you so much for detailing this, I’ve been struggling for weeks with the same problem.
    Anyway, i am looking for the cheap linux hosting. Can you suggest me the one most cheapest hosting provider?

    Thank you so much.

Leave a Reply

Your email address will not be published. Required fields are marked *