The HTTP 504 Gateway Timeout error code indicates that the servers handling requests for a website are having problems communicating with each other. In other words, the main server responsible for processing the request and serving a response to the browser does not receive a response from the upstream server.
So, it sends back to the browser an HTTP 504 error code to signify that the timeout for processing the request has expired. Since the 504 error is rather generic, it does not communicate any information about the concrete cause of the problem.
Creating content on a website is a major challenge for any website owner. But, for most, maintaining the site to ensure its accessibility to visitors is a bigger challenge.
HTTP 504 Gateway Timeout error is one of the worst errors that affect WordPress blogs and e-commerce sites. This type of error not only panics website owners, but also users who struggle to load a site resource.
However, there are very reliable solutions to fix HTTP 504 Gateway Timeout error and ensure a good experience for visitors
In this article, I will first focus on the different reasons that can cause a 504 error. Then, I will outline several solutions that will allow you to effectively fix an HTTP 504 Gateway Timeout error on your site.
Chapter 1: What is an HTTP 504 error and how does it manifest itself?
When a user clicks on a link to visit a website, the browser sends a request to the server that hosts the website data. The server processes the request and in turn responds to the browser with the site resource that corresponds to the request made.
To respond to requests made by a browser, the server sends the browser a set of codes called HTTP status codes. These codes inform the user of the status of his request. Each of these codes has a fixed meaning and does not return all errors.
The HTTP status code 200 OK, for example, indicates that the server has successfully processed the request. In this chapter I will explain what the HTTP 5xx class of status codes means, in this case the HTTP 504 status code.
1.what does the HTTP 504 status code mean?
The presence of a status code belonging to the HTTP 5xx class signals that the server has a problem and is aware that it cannot process the request. This is why they are called 5xx status codes
There are officially five (5) status codes belonging to the HTTP 5xx class:
- HTTP 500: The HTTP 500 Internal Server status code indicates that there is an unexpected obstacle that prevents the server from responding to the request;
- HTTP 501: The HTTP 501 not Implemented error occurs when the server does not load the required functionality to return the request;
- HTTP 502: A 502 Bad Gateway error indicates that the main server processing the request received an invalid response from the upstream server
- HTTP 503: It indicates that the web server is temporarily unable to process the user’s request;
- HTTP 504.
You may also discover other unofficial codes such as:
- HTTP 506;
- HTTP 507;
- HTTP 509;
- HTTP 520, etc.
Coming back to the HTTP 504 error, it usually occurs when two servers are involved in the process of handling the user’s request
When the first server or main server is waiting for a response from the second server or upstream server, which does not respond or does not respond within the normal timeframe.
This results in an HTTP 504 Gateway Timeout error (the time limit for processing the request has expired).
Source : hubspot
Although it may display a similar message in most users, the HTTP 504 error is presented in different ways depending on:
- Of the variety of browsers;
- Web servers
- Operating systems
- Operating systems, etc
Here are the most common messages you may encounter as a result of a 504 Error:
- HTTP 504 ;
- HTTP Error 504 ;
- Error 504 ;
- 504 Error;
- Gateway Timeout Error ;
- Error 504 Gateway Timeout ;
- Gateway Timeout (504) ;
- 504 Gateway Timeout NGINX ;
- HTTP Error 504 – Gateway Timeout ;
- 504 Gateway Timeout – Server took too long to respond;
- 504 Gateway Timeout – Server did not respond in time, etc.
Regardless of the wording, all responses report an HTTP 504 status code error.
1.2) What is the impact of the 504 Gateway Timeout error on SEO?
All 5xx errors compromise the user experience because they prevent the display of web pages while Google’s policy is user-centric
The search engine has implemented several actions in recent years to provide better services to its users.
Google therefore takes seriously all errors that tend to harm or disappoint Internet users when they visit the search engine
A 504 Gateway Timeout error that persists on a web page for a long period of time can cause the de-indexation of the page from the search results.
When there is the presence of a 503 error for example on your site, the crawlers recognize the error during the indexing and understand that it is a temporary problem
This type of error often appears when the site’s maintenance mode is activated. The indexing robots can come back later to explore the site again
On the other hand, an HTTP 504 Gateway Timeout error is definitely not temporary and can persist for a long time if corrective measures are not quickly put in place.
In case the 504 Gateway Timeout error occurs and lasts for a few minutes, bots will try to crawl the page during this period without success. They may not recognize the error right away even if they serve the page from their cache.
But if the error lasts for more than 6 hours on your page, Google will pick up the error and it may become harmful to your site
Also, your site may experience an increase in bounce rate as visitors leave immediately. When visitors access your site via a broken link, displaying an HTTP 504 error, they will not be able to access the site’s content and will be forced to migrate to your competitors.
These unsuccessful visits contribute to an excessive increase in the bounce rate, which is almost hostile to the site’s SEO.
To spare users from this problem, Google may downgrade this page from search results until you correct the error.
1.3. What causes the HTTP 504 Gateway Timeout error?
The HTTP 504 Gateway Timeout error is one of the most frustrating errors that can appear on your site
Like other types of errors in the HTTP 5xx class, the 504 Gateway Timeout error reports a problem with the server, but is silent on the cause of what happened.
So it becomes an enigmatic game for the webmaster or site owner to identify the problem in order to fix it. Here you can find some possible causes for the appearance of a 504 gateway timeout error
If we stick to the meaning of the 504 Gateway Timeout error which refers to the expiration of the timeout between the two servers that communicate to process the request, we can say that the problem is not with the device or the user’s Internet connection.
The HTTP error code 504 indicates that the main server does not receive a response from the upstream server in time to process the request
There are several reasons for this timeout. They can be related to a malfunction or a problem of the upstream server, or a failure.
1.3.1. Server connectivity problems
Most websites are hosted on web servers and this is the condition to ensure the security and proper functioning of the site resources
But when the server hosting your site is down or undergoing maintenance, it may return a 504 Gateway Timeout code to users.
1.3.2. Changing the DNS
When you change your hosting server or move your web site to a new IP address, there are changes that take place in the DNS server (Domain Name System).
Until the DNS changes take effect or are corrected, the site will not be operational. As a result, the server will display an HTTP 504 error code to users attempting to access a site resource.
1.3.3. Firewall configuration error
The firewall of a website represents a counter-attack that protects the site from hostile visitors and attacks of any kind
An error in the firewall configuration can cause the firewall to consider a request from a browser as an attack on the server.
The firewall will then reject the requests. The rejection of the request will cause the main server to time out. The main server will respond to the browser with an HTTP 504 Gateway Timeout status code.
1.3.4. Coding error
Your server will not be able to respond to a content delivery network request if there is an error in the code of your site. The server will respond with a 504 error code because it will not be able to access the site resources that will allow it to serve the requested page.
1.3.5. Possible connectivity error
If a 504 Gateway Timeout error has occurred due to a server timeout, the problem is most likely at the server level and not at the user level
However, it is likely to be a problem with the user’s device or router when the 504 Gateway Timeout error is reported by a single user.
Since there are several reasons for a 504 Gateway Timeout error to appear on a site, it is up to you to analyze each parameter to find the real problem. After that, you need to start a correction process to make your site accessible to your users.
Chapter 2: How to fix the 504 Gateway Timeout error?
Since many parameters are involved in the occurrence of a 504 error status code, in this section I will provide you with tips on how to fix the problem at both the server and client levels.
2.1. How to detect an HTTP 504 Gateway Timeout error?
When you detect an HTTP 504 Gateway Timeout error on your site, you can use some correction methods to make the site available to users. But it is a real problem especially when you have thousands of pages on the site.
Of course, it would be less frustrating if a user would tell you the error and the page where it is located. But since this is not always obvious, you should monitor the site regularly to detect an HTTP 504 error as soon as it appears.
Source : mlocalseo
Regular site monitoring allows you to examine the performance of the site and maintain optimal availability. To do this, you can use monitoring software such as Pingdom which sends instant error reports by email.
This software allows you to detect a 504 error and resolve it as quickly as possible.
Similarly, Screaming Frog, Semrush and Oncrawl all have auditing features that allow you to get a performance review report of a site as well as what needs to be improved on the site.
The reporting tools that Google Search Console offers are also a must-have way to detect an HTTP 504 error on your website. Generally, you Google Search Console sends a message indicating the presence of an error or other problems that may negatively impact the search performance of your site.
Source : mlocalseo
However, Google Search Console reports may pass without you receiving any notifications. It is therefore important to check the platform regularly. To find the Search Console reports, go to the index and click on ”Coverage report” in the left column.
2.2. 504 error fixed on the user’s browser side
It is not likely that the HTTP 504 error code you encountered while browsing the Internet is the result of a problem with your device or connection
This situation happens very rarely or would be subordinate to a 503 error status code to indicate site maintenance status or any other code.
The HTTP 504 Gateway Timeout status code is almost always the result of a malfunction at the site’s server
But as mentioned earlier, it is possible that the browser proxy server you are using or your Internet connection router is returning this type of message.
To make sure that we take into account all the necessary parameters to correct the HTTP 504 Gateway Timeout error, we will follow the following steps:
2.2.1. Reload the web page
When you encounter HTTP 504 Gateway Timeout error code while surfing the Internet, one of the first attempts to fix it is to wait for a few minutes and restart the request.
On most browsers, you can refresh the page by applying the F5 keyboard shortcut. Similarly, you can clear the browser cache with the keyboard shortcut CTRL+F5 before reloading the web page.
In order to eliminate the assumption that the 504 error is due to an overload of your browser’s proxy server, you can also try to open the web page in another browser.
This solution should resolve the HTTP 504 error if the problem is in the user’s browser.
If, despite all these attempts, the problem is not solved, you can check whether the error is only at your level or the site is down for everyone.
There are also online tools that allow you to check whether a site is down for everyone or only for your browser. You can use for example Down for Everyone or Just Me or Is it Down Right Now ?
2.2.2. Restart network devices: Modem or router
The second thing to do to ensure that the 504 error is not the result of a user issue is to restart your network devices
Sometimes, wifi network devices such as modem or router may experience malfunction and cause HTTP 504 Gateway Timeout error
In fact, you may launch your request in the moment when the router is not working normally
Source : Kinsta
This will cause the server to timeout. To solve this problem, you must restart the devices or reconfigure them in order to restart the request.
2.2.3. Check the proxy server configuration
The proxy server is located between the user’s browser and the Internet. Its main role is to act as a gateway between users and websites while ensuring the security and privacy of the user.
In the course of its work, the proxy server rarely causes a 504 Gateway Timeout error. However, a proxy server configuration error may well become a barrier between your browser and the website
This would prevent the site’s server from accessing and responding to your request.
Source : Kinsta
In order to be convinced whether it is the proxy server or not, you can first disable the proxy server and restart the request.
In case you are not using any proxy server on your browser, you can skip this step.
2.2.4. Contact the operator or site administrator directly
After trying all these tips, if the error still persists, it is best that you contact the site administrator directly to inform them of your problem and all the attempts you have made to fix it.
This way, if the cause of the error is known or related to a web project implemented on the site, you can learn more. You will know exactly what problem caused the 504 error and how long it will take to fix the problem and resume operations
However, if the error appears only on your browser or a small part of the users, it would certainly be related to one of the causes mentioned above.
2.2.5. Consult the site later and restart the application
If the previous five (5) tips do not allow you to resolve the HTTP 504 Gateway Timeout error and load the requested page, then you just have to wait until the site administrator resolves the problem. Then you can come back to the site later to access the resources.
2.3. 504 Gateway Timeout HTTP error fixed at server level
The goal of a web project is not limited to providing better content for users. As a website operator, you also need to ensure that the various pages of the website are accessible
It is crucial not to lose sight of many other tasks such as :
- Ensure stable hosting;
- Protect your site against malware;
- A quick and efficient reaction to a technical problem such as a 504 Gateway Timeout error ;
With that, you have several options to try to fix a 504 Gateway Timeout error on your site and allow visitors to access it easily. One of the best SEO tools you can use to get control over 5xx errors is Google Search Console.
2.3.1. Disable the Content Delivery Network (CDN)
The Content Delivery Network CDN is a group of servers whose role is to speed up the delivery of content by bringing users closer
Sometimes, a 504 error may appear because of the CDN you are using on your WordPress site. Indeed, most CDNs will try to display the requested web page from their cache when the main server is unreachable
However, not all CDNs have this feature enabled by default, since it is complex to cache dynamic resources on websites.
To make sure that the origin of the 504 error, the timeout, you should temporarily disable the CDN and test the site loading
If you use an extension(CDN Enabler, W3 Total Cache, etc.) for example to link the site resources to the URL of the content delivery network, it is important to disable all its extensions.
In case you are unable to access the site administration dashboard to disable the extensions, you can do it via SFTP by inserting the name of the directory of the relevant extension.
Similarly, there are CDNs that also act as a full proxy and have additional firewalls between their storage server and the site hosting server. Examples include Cloudflare, Sucuri, etc.
Source :web hosting
When using this type of CDN, you may encounter recurring HTTP class 5xx errors because most of its CDNs store and cache the 5xx errors returned by the site’s main server
However, it is easier to detect the error if it is a problem caused by CDNs like Cloudflare.
The free version of Cloudflare is able to cause a 504 Gateway Timeout error. But there is no faster tactic to disable Cloudflare since it is a full proxy service.
126.96.36.199. First variation of the Cloudflare 504 Gateway Timeout
When the main server of the site responds with a 504 Gateway Timeout HTTP code message, the Cloudflare will show you a custom 504 Gateway Timeout message on the screen.
Source : Kinsta
In this case, the origin of the error is on your site’s origin server and not on Cloudflare’s side. You can use the techniques below to solve the problem or contact your site’s hosting service for assistance.
188.8.131.52. Second variation of the Cloudflare 504 Gateway Timeout
In case the problem is with Cloudflare, the error screen will show the server name “Cloudflare”.
Source : hubspot
At this point, it is likely that Cloudflare is aware of such an error and is already employing means for its resolution
To confirm this, you can go to your webpage and check the Cloudflare system status. A quicker solution is to contact Cloudflare support.
2.3.2. Resolving DNS issues
The HTTP 504 error can be caused by DNS malfunction on both sides (server side and user side)
The most common Domain Name System problem that can cause a 504 Gateway Timeout error at the server side is the break between the FQDN and the IP address of the site.
Indeed, when you move your WordPress site to another server or host, the DNS server does not respond immediately. There is therefore a break between the FQDN (Fully Qualified Domain Name) and the IP address of the website.
A 504 Gateway Timeout error can occur if Internet users make requests during this break
In order for everything to return to normal, you must wait for the new DNS configurations to fully propagate. However, this action can take up to 24 hours.
To check if your DNS configuration has spread all over the Internet, you can use free tools like whatsmydns.net DNS Checker or DNS Map.
On the other hand, you should try to solve the DNS problem on the user side. To do this, you can clear your local DNS cache
This is the same process as clearing your browser’s cache except that this is the operating system’s cache.
For those of you using a Windows system, you can clear your operating system’s cache by opening the “command prompt” and typing the directive: ipconfig /flushdns.
If you succeed in flushing the cache, you will receive the message “Successfully flushed the DNS resolver cache”.
For users of the latest versions of macOS, you can flush the cache by opening the terminal and typing the directive: sudo killall -HUP mDNSResponder.
When you succeed the operation in macOS, you will usually not receive any message. However, you can customize this in the command.
2.3.3. Solving problems on the hosting server side
The Nginx and Apache web servers are the two servers that host most WordPress sites. A 504 Gateway Timeout error on a WordPress site means that Nginx or Apache are not receiving a response from an upstream server within a limited time
Site hosting server issues are the most common reasons for HTTP 504 errors.
Although HTTP 504 error codes can appear on any site, they appear more frequently on e-commerce and high traffic sites
This is because these sites receive a lot of requests and traffic from visitors that overload the server. Overloading delays the server and can cause it to overrun
In addition to high traffic sites and e-commerce sites, blogs can also face 504 errors
To solve this problem, WordPress hosting services offer to upgrade to a higher level hosting plan.
On the other hand, if you host your site on a shared server with another high-traffic site, you may also encounter HTTP 504 errors, as the other site’s traffic slows down the server’s operation.
Also, it should be noted that server overload is not the only cause of a timeout error.
184.108.40.206. Increase the infrastructure on the hosting server side
The server on which you have hosted your site may be a low-capacity server or it may lack sufficient resources to function properly
It is normal for the server to hang up while trying to respond to different visitor requests especially when the traffic becomes heavy
To find a solution to this problem, all you have to do is change your server and find a hosting company whose server has a high performance infrastructure.
220.127.116.11. Increase the number of PHP workers on your site
PHP workers are HTML code generators on WordPress sites. They allow you to determine the number of requests that are not yet processed by the server in the background. When you have fewer workers on your site, or when site traffic exceeds the capacity of the PHP workers, the requests form queues.
The server will not be able to accommodate all the old requests and process them if the queue becomes large. Insufficient PHP workers on a high-traffic site can lead to a timeout, resulting in an HTTP 504 Gateway Timeout error
To correct this problem and allow your site to respond to multiple requests simultaneously, you should ask your web host to increase the number of PHP workers.
18.104.22.168. Fixing firewall configuration problems
A firewall configuration error on the server hosting your site can cause a break between the server and the user’s browser. The firewall may then consider the requests as attacks against the server.
Source : hubspot
It would therefore prevent the server from accessing and responding to the various requests. To make sure that the 504 error is a firewall problem, you can check the error logs and configure the firewall if it is at fault.
22.214.171.124. Make sure your database is secure
An HTTP 504 Gateway Timeout error may be caused by a corrupted file on your database
Similarly, a site or database security issue such as a virus or hack can also create a break between the server and the user’s browser. This problem usually occurs on WordPress sites.
However, before you can find a reliable solution to corrupted database issues on WordPress, you need to detect the real problem first
You can use extensions like WP-DBManager to do a quick audit and find the problem in order to fix it.
2.3.4. Check the themes and extensions installed on your site
WordPress themes and extensions do not cause 504 Gateway Timeout errors in most cases. But, like PHP workers, they can queue up uncached requests and cause a timeout.
One of the extensions that can cause this problem is Woocommerce, an extension that allows you to add e-commerce functionality to WordPress sites.
To effectively fix this problem, you should disable all the extensions installed on your site.
Anyway, you won’t lose any data by deactivating the extensions. The process of deactivating extensions is not complicated if you manage to access the site’s administration dashboard
Open the Extensions screen and select “Deactivate” from the grouped actions menu. To deactivate all extensions, check all the boxes of the extensions and click on Apply to validate the action.
Source : Kinsta
In case you can’t access the site administration dashboard, you can still disable the extensions from the SFTP by applying the method explained previously.
After disabling all extensions, you should now restart the site to check its status. If it is working, it means that one of the extensions is the cause of the error
It is therefore up to you to find the faulty extension by activating the extensions one by one while checking the status of the site.
If you find this very complicated, contact a WordPress developer directly to make sure the job is done right.
2.3.5. Contact your hosting service
If after all the previous attempts to resolve the 504 Gateway Timeout error, the problem persists, it is most likely that the cause of the error is beyond your responsibility
Therefore, you should contact the hosting service of your site so that they can help you detect the problem and solve it.
For many reasons, your site may stop working and send HTTP 504 Gateway Timeout error messages to users. In this article, I have explained the different causes that can cause such an error as well as practical solutions to remedy it.
It is important to remember that most often, a 504 Gateway Timeout error is caused by a problem with the server that hosts the site’s resources. However, there are many other reasons such as insufficient PHP workers, extensions and themes, etc. that can cause a 504 Gateway Timeout error.
It is therefore important that you optimize your site regularly to improve its performance and to avoid the errors that usually affect its traffic.
I hope that the different solutions presented in this article will allow you to correct 504 Gateway Timeout errors on your site. Nevertheless, if you still can’t solve the problem despite all the attempts, you should contact your hosting service so that they can help you get the site back up and running.
Feel free to tell us in the comments if you are still having trouble fixing a 504 error.