Cyber Week Deals! Save 80% on all Shared Hosting Plans & Locations - Starting from $1.99/mo

How to Fix the 504 Gateway Timeout Error in WordPress

Updated on Nov 22, 2022

One of the most common HTTP errors a website owner may encounter is the 504 Gateway Timeout error. Understanding how to repair server errors is essential for many WordPress blogs and/or eCommerce platforms. The 504 Gateway Timeout error does not tell you why it occurred, making it difficult to pinpoint the exact cause of the server timeout. This post will help you understand the error, as well as how to diagnose and resolve it.

This post includes:

What is the Error 504 Gateway Timeout?

When you visit a website, your browser sends a request to the server that hosts that website. That request is processed, and the server returns an HTTP status code, which is displayed only if something goes wrong. If everything goes as planned, you will receive your expected content without problems.

Error 504 is an HTTP status code that indicates that a server did not receive the expected response from another server within a reasonable amount of time when attempting to access a website or complete another request through the browser.

In other words, the error code 504 typically indicates that a server with which you must communicate in order to view a website is not responding quickly enough. The sender of the error message is the server in the communication chain that does not receive a response within the specified time frame and, thus, is unable to fulfill its role.

The server causing the HTTP 504 status code does not have to be the one hosting the web directly, but it could be a gateway or proxy server on the way.

What is a Gateway or Proxy Server?

In its most basic form, accessing a website implies that your browser communicates with the server where it is hosted. So far, so good, don't you think?

Things are never so simple in web or network matters, and there are always exceptions. A proxy server is one of them. These servers are machines that mediate all or a portion of your communications with other servers.

What is the function of this kind of server? There could be several. Here are a few examples to get you started:

  • A proxy can act as a "load balancer," receiving your request and routing it to the server with the least amount of traffic in a group. As a result, the chosen server will respond faster than the one with a heavier workload.
  • They can also be used as firewalls, limiting network traffic. Have you ever had trouble entering a page at work? If this is the case, the fault is almost certainly with a proxy who placed your company there to make you "work more."
  • Proxy servers also allow the Internet to pass through them, making your connection more private. These are the so-called "anonymous proxies" (but be cautious; they are not anonymous).
  • Finally, some server configurations may require a proxy configuration with itself. It is uncommon, but in some programming languages, such as PHP, it may be required.

As you can see, there are many reasons why a proxy can mediate a connection. In essence, you may think that the server that hosts the web you want to see is simply the last link in a long chain in charge of processing the HTTP request that you have sent.

As a result, the proxy is a node in a much larger network that connects and routes communications between various actors: client, server, and other necessary nodes. When any of these actors fails to respond within a reasonable amount of time, the proxy server marks the connection as failed and returns the error 504 to inform you that "the fault is of another server that has not responded" is due to slowness, configuration issues, or any of the other causes discussed in this article.

It varies a bit depending on the website and the type of proxy that launched it, as administrators can customize the look of the error 504 page. This is why some websites have custom messages for HTTP status codes.

How Does the Error Appear?

The error 504 appears instead of the website you want to visit, but the error page may also include the site's header or footer, and a personalized message informs you of the situation. A 504 error, on the other hand, can appear as a simple white screen with a large "504" at the top of the browser.

Some of the most common messages for HTTP 504 code are:

  • HTTP Error 504 – Gateway Timeout;
  • Gateway Timeout (504);
  • 504 Error;
  • “504 Gateway Timeout NGINX”;
  • “This page isn’t working – Domain took too long to respond”;
  • “504 Gateway Time-out – The server didn’t respond in time”;
  • A blank white screen in WordPress;
  • 504 Gateway Timeout;
  • HTTP 504;
  • Timeout error 504;
  • Bad gateway error.

What Causes the HTTP Error 504 Gateway Ttimeout in a WordPress Site?

As previously stated, error 504 is a server connection error. As a result, you may overlook the fact that there is a problem with your connection or device. The majority of the time, error 504 is caused by another server taking it easy, being down, or not functioning properly.

As with most HTTP response codes that indicate an error, determining the exact cause of the 504 Gateway Timeout can be difficult, after all, communication between client, web server, and even third-party services is a difficult problem.

In general, the most common reason is that the server with which you are attempting to communicate is currently overburdened or down. It is unable to function properly, and the browser displays the 504 Gateway Timeout status code to the user. However, network connectivity issues or the fault of a third-party plugin are also possibilities.

Now we'll look at solutions to all of these potential causes. In most cases, the 504 error is generated by the server, but there are some things you can try:

504 Gateway Timeout Error SEO Impact

Unlike 503 error, which is used for WordPress maintenance mode and tells Google to return later, a 504 error can have a negative impact on SEO if not corrected immediately. If your site is only down for 10 minutes and is being crawled frequently, the crawler will simply retrieve the page from the cache. Google may not even have a chance to re-crawl it before it goes back online. You're perfectly fine in this scenario.

However, if the site is down for an extended period of time, say 6+ hours, Google may interpret the 504 error as a site-level problem that must be resolved. This could have an effect on your rankings. If you're concerned about repeat 504 errors, you should investigate why they're occurring in the first place. Some of the solutions listed below may be useful.

Fixing HTTP Status Code 504 as a Visitor

The error 504 likely has nothing to do with you, so the normal thing is that you do not solve anything.

The first thing is to reload the page: press F5 or the Refresh button on your browser. If error 504 was a temporary failure, simply updating the page may allow you to enter.

Caution: Do not reload the page if the error appears just after making a payment. You may duplicate the transaction.

Check to see if the website is causing problems for everyone or just you on your local network. You can do it with a variety of tools, the most well-known of which are Pingdom Tools, Down For Everyone Or Just Me, and Is It Down Right Now. Enter the domain you're attempting to access and see what happens. There won't be much else you can do if the internet goes down.

Wait a while and try again. If the error 504 is really being caused by a network failure of the website or a server with which it communicates, the chances are that all visits are experiencing the same error as you. It is likely that the person in charge of the web is already aware and is working to solve it.

If the web is only causing you problems, the failure is on your end (this is very, very rare). To see if the error 504 is related to your browser, try clearing the cache, accessing in incognito mode, or directly accessing from another browser. If you can't, your computer or network equipment may be experiencing a temporary problem: try accessing from another computer, network connection, or (easiest) from your mobile phone.

If nothing works and you're about to throw yourself out the window, give it one more shot. Check for DNS server failures using Google's public DNS.

If the problem is not on your end (which is normal) and you need access quickly, you can contact the webmaster and report the error 504 Gateway Timeout. Most websites have a social network profile where they interact with their followers. The most important websites will usually have an email address or phone number where you can contact them.

How to Fix the HTTP 504 Status Code as a Web Administrator

To summarise, go through the following basic steps to fix the 504 gateway timeout error in WordPress:

  • Look for server connectivity issues;
  • Check for any DNS changes;
  • Sift through your logs;
  • Fix faulty firewall configurations;
  • Comb through your website’s code to find bugs;

Remember that it is always better to be cautious than to be sorry later. Before making any system changes, you must create a complete backup of your installation, database, and so on.

First and foremost, ensure that the server on which you are hosted is operational. If the service that manages the final response is overloaded and takes a long time to respond, it may result in a 504 error (although the most common would be a 503 error, the truth). It is best to rule out this possibility as soon as possible: you can check your hosting response using Pingdom Tools.

The 504 status code could also be the result of recent changes or updates to your website. The simplest method is to review the bug report. WordPress users can add the following lines to the wp-config.php file to see all of the results in debug.log (in wp-contents):

define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );

Database errors can also cause the 504 Gateway Timeout error in WordPress. Install WP-DBManager and test the "Repair DB" and "Optimize DB" functions to see if they work. You should also ensure that the .htaccess file is error-free, especially if you have recently reinstalled WordPress.

It doesn't hurt to check plugins if you're getting a 504 status code in WordPress (especially caching ones). Turn them all off for a while and see if the error persists. If not, you'll know it was caused by a plugin. Turn them all back on and off one by one until you figure out which one is causing the problem.

Do you use a CDN service? The error 504 will be customized in the case of a website security company: "504 Gateway Timeout/". Deactivate the CDN, wait a few hours for DNS propagation, and the error 504 should go away. You can also get in touch with the website security company's support to go over what happened. It wouldn't hurt to try accessing your website through the host's file to rule out any security issues.

Finally, if nothing else works, contact your hosting provider. Error 504 could be the result of a problem that they can fix.

Conclusion

There are numerous methods for troubleshooting and resolving 504 gateway timeout errors on your WordPress site. The good (and bad) news about error 504 is that it usually originates from an intermediary server, so you can't do much to fix it as a user. In general, you can wait a little longer, and the problem will be resolved without your involvement. However, if you're in a hurry, if you're using an online application and can't keep working in the meantime, or if the affected website is your own and you're losing traffic, you might want to try the solutions we've suggested in this post.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

WordPress Hosting

  • Free WordPress Installation
  • 24/7 WordPress Support
  • Free Domain Transfer
  • Hack-free Protection
  • Fast SSD Storage
  • Free WordPress Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More