How to Fix the 504 Gateway Timeout Error in WordPress

On your WordPress site, have you ever received a 504 gateway timeout error? Users may be unable to access your website as a result of this error. Worse, if the underlying issue is not resolved, it can disappear and reappear on its own. We’ll show you how to fix the 504 gateway timeout error in WordPress in this article.

In WordPress, how to fix the 504 gateway timeout error

What Causes the Error 504 Gateway Timeout?

When a server is unable to connect to an upstream server to complete a request, the 504 gateway timeout error occurs.

A 504 gateway timeout error, for example, will appear in your website firewall, such as Sucuri, which is unable to connect to your WordPress server.

The look and feel of the error page, as well as the message, may vary depending on your WordPress hosting provider, proxy server, or browser. Some of the most common 504 gateway timeout error messages are listed below.

  • Gateway Timeout: 504
  • HTTP status code 504
  • ERROR 504
  • Timeout on the Gateway (504)
  • Gateway Timeout HTTP Error 504
  • Error: Gateway Timeout

Error 504: Gateway timeout

While a proxy server being unable to reach the upstream server is the most common cause of the error, it can also be caused by other hosting configuration issues.

Let’s take a look at how to troubleshoot and resolve the 504 gateway timeout error in WordPress.

1. Reload and wait

A temporary glitch on your WordPress hosting servers can sometimes cause the 504 gateway timeout error. Allow a few minutes to pass before attempting to reload your website.

If the problem goes away, there’s no need to take any further action. Continue reading to troubleshoot and fix the problem if the error persists or reappears after a while.

2. Disconnect from the VPN

VPN should be disabled.

If you’re using a VPN to access the internet, try turning it off. If your VPN server is unable to receive a response from your managed WordPress hosting server, a 504 gateway timeout error will occur.

If your website reappears, the VPN server was the source of the problem. If using a VPN is critical to you, you can now try switching to a different VPN server. If the error persists even after switching servers, you should seek assistance from your VPN service provider.

3. Disable the Website Firewall

If you’re using a DNS-level website firewall, such as Sucuri or Cloudflare, try temporarily turning it off. This will enable you to connect directly to your WordPress hosting server.

Error 504 on Sucuri

If that resolves the problem, your hosting server is most likely blocking the firewall IP addresses that are causing the problem. You’ll need to get a list of IP addresses from your firewall service provider, then contact your web host to whitelist those IPs.

Disabling the firewall may sometimes reveal the actual server error notice. If that’s the case, you should look over our list of 500 WordPress errors to figure out what’s wrong.

4. Turn off the proxy server on your network.

If you use a proxy server to connect to the internet, that server may be unable to receive a response from your WordPress website.

To see if your website is down just for you or for everyone, try accessing it through a different internet connection or using online services.

If it’s only down for you, you’ll need to adjust your network settings. You can ask your internet service provider or a network administrator to help you troubleshoot the problem.

5. Make a DNS Server Change

DNS servers are used to manage your internet connection. These servers assist your computer in connecting to various internet servers.

A 504 gateway timeout error can occur if the DNS servers you’re using are down or unable to connect to your website. Changing the DNS servers your device uses is the simplest way to check this.

You can find them in the Control Panel » Network and Sharing Center screen on a Windows computer.

In Windows, you can change your DNS servers.

On a Mac, you’ll find them under System Preferences » Network. Select the DNS tab after clicking the Advanced button.

Mac DNS configuration

You can apply changes by changing your DNS server address to 8.8.8.8 and 8.8.4.4.

Now is a good time to go to your website. If this fixed your problem, you’re finished. The issue was with your internet connection, which has now been resolved.

6. Make sure your WordPress database is clean.

A 504 gateway timeout error can also be caused by a corrupt WordPress database. Don’t be concerned; your WordPress data is most likely secure. Your database, on the other hand, may require some spring cleaning.

This is easily accomplished by using phpMyAdmin or a plugin like WP-Sweep to optimize your WordPress database. Before you do anything, make a backup of the WordPress database.

7. Turn off all WordPress plugins and use the default theme.

A 504 gateway timeout error is less likely to be caused by WordPress plugins and themes. However, if a plugin or theme makes too many requests to the server, some of these requests are likely to fail and result in a 504 gateway timeout error.

You’ll need to deactivate all WordPress plugins via FTP to test this.

Turn off all WordPress plugins.

After that, check to see if the error has been resolved on your website.

If that’s the case, one of your plugins was to blame. You must now activate each plugin one by one until the error can be reproduced. This will assist you in identifying the plugin that is causing the issue.

If deactivating plugins didn’t fix the problem, you should look into your WordPress theme. You’ll need to use phpMyAdmin to change your WordPress theme.

Check your website after switching to the default WordPress theme to see if it’s working.

8. Additional Troubleshooting

Finally, as a last resort, you should contact your hosting company for assistance. They might be able to help you solve the problem or direct you in the right direction.

We trust that this article has taught you how to fix a 504 gateway timeout in WordPress.