Fix the 504 Gateway Timeout Error in WordPress

If you are facing a 504 gateway timeout error on your WordPress website, we understand if you are frustrated. This error is quite a troublemaker, especially because it makes your WordPress website inaccessible to users. Another problematic aspect of this error is that it can disappear and reappear on its own. This type of error will keep troubling you until the origin of the error will not be detected and resolved completely.

Even if you are not very sure right now about how to resolve this error, we will help you in fixing it. All you have to do is to go through the tips, tricks and techniques mentioned in this article. Keep reading.

What is a 504 Gateway Timeout Error in WordPress?

In order to complete a request, a server may try to connect to an upstream server. When this connection gets hindered because of any reason, the 504 gateway timeout error appears. Suppose, that your website firewall is trying to connect to the WordPress server and this connection is not getting completed because of whatever reason. In this situation, the 504 gateway timeout error will appear in WordPress.

There are two popular causes of the 504 gateway timeout error in WordPress:

  • A proxy server is unable to reach the upstream server.
  • Glitches in the hosting configuration.

Error Messages:

You may see variations in the error messages of this type of WordPress error. These variations in the error messages depend on the following:

  • Your WordPress hosting company.
  • The proxy server.
  • The browser.

Some familiar 504 gateway timeout error messages are:

  • 504 Gateway Timeout
  • HTTP 504
  • 504 ERROR
  • Gateway Timeout (504)
  • HTTP Error 504 – Gateway Timeout
  • Gateway Timeout Error

Fixing the 504 gateway timeout error in WordPress:

Method 1: Reload Your Website:

If the 504 gateway timeout error is caused because of a momentary issue, it should disappear automatically in some time. Wait for some time. Reload your WordPress website. If it loads successfully, then it was just a temporary issue and you can continue your work. If the error reappears, even after reloading, you might have to go through the next steps mentioned in this article.

Method 2: Turn off VPN:

When a VPN server is unable to connect to the hosting server, the 504 gateway timeout error may get triggered. Disable your VPN service. If this resolves the error, it is clearly the VPN server behind the error. Now, you can either change your VPN server or you can contact VPN service support for help.

If the error reappears even after disabling the VPN service, you can continue reading the article. Also if you are not using a VPN service, this step is not for you. Read further to find the relevant solution for your specific issue.

Method 3: Turn off the Website Firewall:

A DNS-level website firewall like Sucuri or Cloudflare may also cause the 504 Gateway Timeout Error in WordPress. By disabling the firewall, you can directly connect to your WordPress hosting server.

Disable the firewall and check if the error gets resolved. If you are able to load your WordPress website, then it is possible that the WordPress hosting server is blocking the firewall IP addresses. For a permanent solution, you will have to contact both your firewall service provider and web host. Share the list of IP addresses from your firewall service provider to your web hosting provider. Ask them to whitelist the listed IPs. You can again enable your website firewall after this.

If this method does not work for you, you can check the next one.

Method 4: Disable Your Network Proxy:

Are you connected to the internet through a proxy server? If yes, then there might be a connection error between the proxy server and your WordPress website. We suggest you to connect to the internet through a different server. You can also check if its your website which is down. For this you can make use of some online tools. You will be required to make some modifications in your network settings, if its your website which is down. We also recommend you to take help from your internet service provider or a network admin. They will assist you in finding the exact issue.

Method 5: Change Your DNS Servers:

DNS servers faciliates the connection between your and the different servers on the internet. A 504 gateway timeout error may get triggered in either of the two situations:

  • When your DNS servers are down.
  • When your DNS servers are unable to connect to your WordPress website.
  • In this case, you will have to change the DNS servers for your computer. For this, you can follow the below steps:
  • For Windows computers,
    • Go to Control Panel » Network and Sharing Center page.

  • For Mac computers,
    • Go to Settings » Network page.

  • Click on the Advanced button.
  • Select the DNS tab.
  • Change your DNS server address to 8.8.8.8 and 8.8.4.4.
  • Apply changes.
  • Reconnect to your website.

If the error gets resolved, You can stop here. And if the error still persists, keep reading the article for more solutions.

Method 6: Clean up your WordPress Database:

A possible cause for 504 gateway timeout error is a corrupt WordPress database. In this situation, your WordPress data is usually safe, but a spring cleaning of database is required. For this you can make use of either of the following:

  • phpMyAdmin
  • A plugin like WP-Sweep

The intention here is to optimize your WordPress database. But first create a backup for your WordPress database before doing anything.

Method 7: Update WordPress Themes and Plugins:

WordPress plugins and themes are not a common cause for the error of 504 gateway timeout in WordPress. But they may trigger this error if they start sending too many requests to the server. In this situation, some of the requests may drop off. The error thus appears.

The next source of error that you need to confirm is your theme and plugins. To move ahead with this, you can follow the below steps:

  • Connect to your Website using FTP.
  • Deactivate all your WordPress plugins.

  • Reconnect to your website.
  • If the error gets resolved, start activating your plugins one by one.
  • Check your website after activating each plugin.
  • Once you find the error-causing plugin you can replace the plugin with a suitable alternative.
  • Or you can contact the plugin author for support.
  • If deactivating and activating the plugin makes no effect on the error and the error still persists, you will have to make the next check and that is your WordPress theme.
  • Switch your WordPress theme to the default theme.
  • Reconnect to your website.
  • If the error gets resolved by this, the source of the error is your WordPress theme.
  • Now, you can either change your theme or can contact your theme support for help.

If all the above method fails, you can check for the next method in this article.

Method 8: Check the Hosting Server:

Sometimes this type of WordPress error is caused by your hosting server itself. It could be because of some new modifications or updates. If all the above method fails, the last step that we recommend is to contact your web hosting service provider for support. They will help you in finding the cause of the error and will also provide the required solution.