Enter your search term

Search by title or post keyword

How to Fix 504 Error: Gateway Timeout Error

Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website

Contact us for Questions

Want to fix a 504 error? Whether you encounter it while browsing or on your own website, you’ve just come to the right place.

The 504 error is among the most common errors that frustrate visitors and website owners.

Like every other HTTPS status code in the 5xx, 504 error is a server-side signal code indicating a gateway error, and the server can’t respond to the client’s request.

This error breaks the user experience and may prevent them from returning to your site, especially if it happens often.

The implication is that your website will lose traffic which negatively affects your SEO and causes a loss of revenue.

Downtime is no business, friend. It’s essential you take action as soon as the error shows face. In this comprehensive guide, we’ll explore the possible causes of the 504 gateway timeout error and how you can fix it.

Frequently Asked Questions

What Does the 504 Error Mean?

The 504 error indicates that a client fails to receive a timely response from the server when trying to load a webpage.

It shows that one server could not get a response from the server hosting the website or web application that the user is trying to access.

What Causes a 504 Error?

There are several reasons why a 504 error can occur. Web server overload, network connectivity issues, limited PHP resources, and corrupted or outdated DNS Cache are the most common causes.

There are other not-too-common causes, like corrupt browser cache and firewall issues. This guide will look at all these causes and their corresponding solutions.

What You’ll Need to Fix 504 Error: Bad Gateway Error

  • Web Host Cpanel: If the 504 gateway timeout error occurs on your website, you’ll need access to your hosting account Cpanel to fix it.
  • WordPress Admin Access: To fix this error, you may need to disable your WordPress plugins. As such, you need to access the WordPress admin dashboard.

How to Fix 504 Error: Gateway Timeout Error

According to the Internet Engineering Task Force (IETF), “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 in order to complete the request.”

As stated above, the 504 gateway timeout error is a server-side problem. However, they may also occur because of incorrect settings on the client side. We’ll look at all possible instances of the error from both sides and show you how to fix them.

Before proceeding, you should know that this error appears in different forms depending on your browser or server. Some of the most common variations of the 504 gateway error include;

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

Regardless of the error message, the problem is the same, and you can fix them using the methods in this guide. Let’s go.

Before using advanced troubleshooting methods, trying some basic fixes is better. They could be all you need to get rid of the 504 error. Here are some you should try;

  • Reload the Page: The first thing you should do when you see the 504 error is to reload the page. This may sound commonsensical, but it does work in cases where the server could not respond to your request because it’s handling touch requests at that moment. Refreshing the page should fix it. Click the refresh button next to your browser address bar to reload a web page. Alternatively, press F5 on your keyboard.
  • Check if the Website is Down: If the 504 error still appears after reloading the page, then the website might be having a downtime. You can check if the website is active by using the Is It Down Right Now online checker. Simply input the website URL and hit the enter button. You’ll see if the website is currently active.
  • Try A different Browser or Device: You can try accessing the website in a private browsing window, also referred to as incognito mode in Google Chrome. If you can access it, the problem is either with your browser or DNS cache.

If the 504 error only happens on one device, the problem might be with your DNS cache or network connection. You’ll see how to fix both soon.

In most cases, you’ll be able to fix the problem using any of the above methods or at least identify the cause of the problem. Now let’s look at the major fixes below.

  • Fix #1: Disable Proxy Server Settings
  • Fix #2: Flush DNS Cache
  • Fix #3: Clear Browsing Cache
  • Fix #4: Reboot Network Devices
  • Fix #5: Contact Website Admin
  • Fix #6: Check Your Website Error log
  • Fix #7: Temporarily Disable WordPress Plugins
  • Fix #8: Disable CDNs Temporarily
  • Fix #9: Increase PHP Timeout Limit

Fix #1: Disable Proxy Server Settings

Typically, your computer doesn’t need a proxy server to connect to the internet. But many users still prefer to use them to keep their online activities private. Occasionally, incorrect proxy server settings can lead to a 504 bad gateway error.

You can skip this step if you are confident you aren’t using a proxy server. However, you might have set it in the past and not remember. So, it’s safe to check and be certain.

Also, some devices or operating systems do not have proxy server settings. If this applies to you, skip this step and move to the next fix.

To disable the proxy server on your device, here’s how.

To disable the proxy settings in Windows, click the Start button on your taskbar or Keyboard. Next, select the Gear icon to reach the Window Settings page.

20

On the next screen, locate Network & Internet on the left pane, and select Proxy from the options on the right.

21 1

Next, go to the Manual Proxy Setup section and click the Set up button.

22

After that, toggle Use a proxy server and click the Save button to apply your settings.

23 1

Now you can revisit the website to confirm if the 504 bad gateway error as been fixed.

Fix #2: Flush DNS Cache

A DNS issue on both the client and the server side can cause the 504 Error.

Client-side DNS errors generally occur due to corrupted or outdated DNS cache, while unresolved IP addresses cause server-side DNS issues. We’ll look at the server side later.

To resolve client-side DNS errors, you need to flush the DNS cache on your device. Here’s how

Press the Windows + R keys on your keyboard to open the command prompt dialogue box. Next, enter cmd into the box and click the Open button.

24 1

Once the command windows open, type ipconfig/flushdns and hit Enter.

25

The command will run, and you’ll see a success message like below upon completion.

26

That means the DNS cache files have been cleared, and the DNS resolver cache is reset to default. You can now reaccess the website to see if the 504 bad gateway error has disappeared.

For Server side DNS,

If a WordPress site hosting provider is recently changed or transferred to a new IP address, updating the website’s DNS server will take some time. So the website may return a 504 gateway timeout error to users in the interim.

Waiting until these DNS updates take effect is the only option. If you are the website owner, you can use a DNS propagation checker to see if the process is finished because DNS propagation takes between 24 and 48 hours to complete.

Fix #3: Clear Browsing Cache

A corrupt browser cache can also cause the 504 bad gateway error. In this case, clearing your browser can help fix it.

Clearing the browser cache essentially means refreshing the browser’s memory which helps take care of any corrupt cache file that may be causing the error.

Follow these steps to clear your browser cache

Open your browser and click the menu (three-dot) icon at the top right corner. Select Settings from the dropdown to open the browser settings page.

Untitled 1

Select Privacy and security on the left pane and click on Clear browsing data on the resulting page.

Untitled 2

Next, choose a time range (we recommend “All time” for best results). Next, select Cached images and files.

27

Finally, click the Clear data button and wait for the process to complete.

Done! Your browser cache files have been erased successfully. Try reaccessing the site to check if the 504 error no longer appears.

Fix #4: Reboot Network Devices

Another possible cause of the 504 gateway timeout error is a poor internet connection.

If your internet connection is slow or unstable, you may experience this error. To fix this problem, try restarting your modem or router. Follow these steps,

Turn off your network modem and WiFi router by pressing or unplugging the power button. Wait at least two minutes to allow the devices to power down fully.

After that, power On the network modem and wait for it to connect. This may take a few minutes, depending on your ISP. Connect your WiFi router and try reloading the page.

Fix #5: Contact Website Admin

If you’ve used all the above fixes and the error persists, likely, the error is not from your end. As such, it’s best to contact the website administrator.

If this 504 error affects your own website, failure to fix it on time can result in SEO damages and loss of potential customers and revenue. To avoid both, keep reading to see how to fix it.

How to fix 504 Gateway Timeout Error on Your Website

Fix #6: Check Your Website Error log

Code conflict or corruption due to recent changes or updates on a WordPress website can cause the 504 error. In this instance, reviewing the error log will help find the problem fast.

You can log in to your hosting account dashboard to check your error log.

We’ll use the Hostinger dashboard to activate the PHP error logging option. The steps are the same if you use other browsers. Let’s see:

Log in to your web host Cpanel, locate the Advanced section and click on PHP Configuration.

28

Next, switch to the PHP options tab and Check the logErrors box.

29

Lastly, scroll to the bottom of the page and click the Save button.

If your hosting provider doesn’t offer PHP error logging feature, you can enable debug mode in your website root folder by adding the following code snippets to the wp-config.php file:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG_DISPLAY', false );

Use these steps:

Log in to your web host Cpanel. Locate Files and click on File Manager under it.

30

Inside File Manager, open the public_html folder and locate the wp-config.php file. Right-click on it and click Edit.

31

Now, paste the code above and click the Save icon at the top right corner.

32

Setting the WP_DEBUG_LOG to true will create a new file titled debug.log inside your wp-content folder.

You can check the file to see what recent error has been documented. You’ll see what causes the 504 error and how to fix it.

Fix #7: Temporarily Disable WordPress Plugins

Sometimes, the 504 gateway timeout error can be caused by one of your WordPress plugins, particularly caching plugins.

These plugins often send additional requests to the server, thereby increasing the workload on your server and triggering the error.

Corrupt or incompatible plugins can also cause the 504 error.

To determine if a plugin is the cause of the error, you need to disable all plugins and check the error temporarily.

Check out our comprehensive guide for different methods to disable WordPress plugins in bulk and units.

Start by first disabling all your plugins. If your website functions well when all plugins are disabled, the next step is determining which plugin produces the error. So disable them one after the other until you find the culprit.

Fix #8: Disable CDNs Temporarily

Content Delivery Networks may occasionally trigger the 504 error. Most CDNs attempt to provide the requested resources from their cache when a site’s origin server is unreachable. If this cache has a problem, your website might throw up a 504 error.

If you are using a CDN WordPress plugin, the simple way to troubleshoot the problem is to disable the plugin temporarily. The same is the case with other third-party plugin services.

Cloudflare is one of the most popular CDN. There are two variations of the 504 gateway timeout error that you could run into while using it.

If the 504 band gateway error message contains Cloudflare, as in the picture below, the problem is from the service.

34

In this case, the quickest solution is to temporarily disable Cloudflare on your site. After that, you can contact Cloudflare support for further assistance.

Another variation of the 504 bad gateway error will look like the one below.

If you see this, the problem is not with Cloudflare but with your hosting provider.  You may need to open a support ticket to resolve the problem.

35

Fix #9: Increase PHP Timeout Limit

The 504 gateway error can also appear due to a PHP time-out error. This happens when a single PHP process takes longer than the pre-configured maximum execution time and the request times out.

In this case, increasing your PHP timeout limit can fix any connectivity issues on your server. You’ll find this option in your hosting account dashboard. Here are the steps involved.

Log in to your web host Cpanel, navigate to the Advanced section, then open PHP Configuration.

28

On the next screen, switch to the PHP Options tab, and scroll down until you locate the maxExecutionTime field.

36

The default value is 60 seconds. Increase it to 120 and click Save. If that doesn’t resolve the issue, increase the value to 180 seconds.

If this is unavailable in your dashboard, contact your hosting provider to help increase PHP execution time.

More Helpful Error Troubleshooting Tutorials;

  • How to Fix 502 Bad Gateway Errors: If you run an online business, having your website always available to users is crucial. 502 bad gateway errors can disrupt that. Fix it now.
  • How To Fix 401 Errors: The HTTP code “401 Unauthorized Access” is a client-side error that prevents users from accessing a site or a specific web page. Check out this guide to fix it.
  • How to Fix HTTPS Error 503: Another common server-side error your WordPress website can encounter is the 503 Error. This actionable guide teaches how to deal with it once and for all.

Wrapping up

There are several causes for the 504 Gateway Timeout error that could affect your website or another website you are trying to access. Thanks to this post, you should now be able to troubleshoot all of them.

In most cases, these errors are the result of problems on the server. If the methods in this guide don’t fix it, you should contact your host to resolve the problem immediately. We hope you find this guide helpful.

Need more help? Drop us a line in the comment section below.

Leave a Comment