Categories: WordPress Tutorials

How to fix 504 Gateway Timeout Error?

As a visitor of the site and website owner, it is awful to experience errors on the site. Error pages lead to the potential loss in revenue when your customers are there to buy a product or gather some information. It takes time to build trust and brand value in the online presence but the appearance of errors hurts you the most. In this comprehensive guide, we will discuss how to fix 504 Gateway Timeout Error.

What is error 504 Gateway Timeout?

When a user opens a site, a request is made to the web server by the browser. The server answers the browser after processing the request. If there is a delay while answering, it returns an error on the client-side.

It occurs due to the incompletion of the request by the server. A page could not be loaded due to the late communication between a server and another upstream server. Due to this, the initial server times out as a result one of the web pages is not loaded waiting for the response from an upstream server.

504 Gateway Timeout Error is one of the common errors where the exact issue is not mentioned. Depending on the browser or operating system, the display message during the error may be different. The respective error message associated with the particular page or website will be shown to the users.

Since the issue is due to the server, it is usually known as server error 5xx status codes. Besides the 504 Gateway Timeout Error, 500,501.502,503 are the most common 5xx errors that you will face.

Causes of 504 Gateway Timeout Error

Since the 504 Error is the result of server timeout, the issue is mostly because of server conditions. The server may be down, overloaded in its peak time, or may simply be in the process of upgrading and not functioning well.

The server issues can appear due to the change in the DNS, or due to the firewall configurations. There can be connectivity issues in the router, modem, or other devices and the lag due to the internet connection.

How to fix 504 Gateway Timeout Error?

The errors can be classified into two groups, client-side errors, and server-side errors. Here is the list of things that you need to learn to know how to fix 504 Gateway Timeout Error in WordPress sites.

Reload Web Page

First of all, try to reload the page after some time. Before reloading the page, you can also hard refresh the browser so that you do not load any cached version of the page.

Clear history cookies and cache

If the issue is due to caching or cookies, you can also clear the cache or check in a different browser or run the webpage in incognito mode.

Try restarting your device and router to make sure that the issue is not due to networking.

Wait for Server Response

Depending on the server load, sometimes the site may not load due to the problem in between the devices that comes in between you and the web host.

In this case, you cannot do anything at all. You just have to wait and see if the server responds well and gives a green signal to you. While you are waiting for the server response, it is still a good idea to try other ways that can fix the issue.

Disconnect from your VPN

If you are using a VPN to surf the internet to hide your identity, then you can also try opening the site once by disabling it.

If the 504 gateway timeout error is solved after disconnecting the VPN, then you can say that there is some issue that is coming from the VPN. This may be due to the fact that VPN is not able to contact your web hosting server.

Disable Firewall

If there are any firewall or security checks that prevent unknown users from entering your site, you need to check their settings properly.  There are cases where the firewall is responsible for errors during browsing.

If the problem solves after disabling the firewall, you need to check and solve the firewall settings that are causing an issue.

Check DNS

If you have transferred your site to a different host, you need to make sure that the DNS setting is properly configured. The DNS propagation can take up to 48 hours depending on the DNS servers. If your change is already effective then re-check the DNS settings and name server of your site.

Check Error Logs

If your host provides access to server logs in cPanel, then it is a good practice to check the errors. Usually, it is stored inside the public_html in the error_log file.

Check Error Logs

But, if your host uses anything else except cPanel, you will find this to a different location inside your hosting screen.

Check CDN

If you are using Content Delivery Network, it may throw you an error if it is not properly configured. It can also possibly happen when your server is down and CDN is not functioning properly due to it. When a CDN contacts a web host that is down for maintenance, it usually throws an error if the website cannot load its cached resources.

If CDN is the cause of the issue, turning off CDN will help to solve it. If the problem still exists, there may be some other issue.

Clean the Database

You need to clean and optimize the database to increase the performance of your site. Sometimes a cluttered database is responsible for the various errors on the site.

There are also plugins like WP-Optimize and WP ROCKET that clean the database for you.

Database Cleanup using WP ROCKET

So, it is always a wise choice to optimize the database at regular intervals.

Switch to the Default Theme

You can use the default theme to troubleshoot the site if the problem is due to the theme. If the theme is poorly coded or has some vulnerability, switching the site to the default theme must remove that error and you can next search for that particular error to fix it.

Disable WordPress Plugins

There is a high chance of an error due to the WordPress Plugins. So, you should disable the plugins from your site one at a time and check whether that solves the issue. If the problem is due to the plugin, you will be able to identify the plugin from this process. After the identification of the plugin, you can now fix the plugin and re-activate it again if you need the plugin.

Check Htaccess File

.htaccess file is an important file that should not be edited if you don’t have proper knowledge of what exactly you are doing. Whenever you change the .htaccess file, you should take a backup of the file so that in case anything happens unexpectedly, you can replace the backup file.

Check htaccess file

There are plugins that ask permission to edit the .htaccess file from their plugin settings. So, you should also check if the .htaccess is corrupted because of them. It happens rarely, however, you need to be sure of it. While disabling the plugin like in the above process, check the .htaccess file code if it has been changed. If the particular plugin is identified, then you need to make sure that you do not allow that plugin to rewrite rules in the .htaccess file again. It is better to replace that plugin.

Contact Web Host or ISP

Sometimes the IP assigned to your device may be causing the problem to load the pages on the internet. If your device is surfing the web from the list of IPs that are blocked by the website owner, you will never be able to open that site with any of your devices. In that case, you need to contact your ISP and they will look into this issue and change your IP. This solves the problem quickly.

However, if you have tried multiple fixing options and still have not succeeded consider contacting your web host provider. They might have ideas that will fix the error shortly.

Wrapping Up

If you follow all the points listed in this post, then we are sure that you should be able to know how to fix 504 gateway timeout error in WordPress.

Related Posts

  1. How to use WebP images in WordPress
  2. How to block IP address in WordPress
  3. How to fix 403 Forbidden Error
Amar Raj Mahato

Amar Raj Mahato is a Digital Marketer who is currently working as a content creator and SEO specialist in CodeFlist.com

Share
Published by
Amar Raj Mahato
Tags: WordPress

Recent Posts

How to fix 403 Forbidden Error?

In the present context, every business owner maintains their own site for the online presence. When something unexpected happens with… Read More

3 years ago

How to use WebP images in WordPress?

If there are too many images on your site, they are uploaded in either PNG or JPG format. Learning how… Read More

3 years ago

How to block IP address in WordPress?

Keeping the website safe from bots and malicious users is of utmost importance to the site. If you know how… Read More

3 years ago