What is a 504 Gateway Timeout error, and how to fix it? (2023)

Table of Contents

In essence, the Internet is a global network of interconnected computers in constant communication. Typically, you can browse online for any information thanks to that interdependence. However, you may encounter connectivity issues that prevent you from accessing a website on some occasions.

A 504 Gateway Timeout is a widespread error when the upstream server can not complete your request in time. It is a frustrating experience for website visitors, which can be bad for your business.

In most cases, 504 errors are due to issues with the website itself or server-side problems. This HTTP status code may negatively affect a website’s SEO and cause a loss of visitors or revenue. Therefore, website owners should promptly take care of such errors to minimize their detrimental effects.

In this post, we will get into the 504 Gateway timeout meaning, its causes, and how to fix it.

What does the 504 Gateway Timeout Error mean?

When you try to load a website in your browser, it sends a request to the web server which hosts the site. Usually, the server would return a 200 OK status code when the request is processed successfully. However, if the server takes too long to complete this request, your browser may display the HTTP error code 504.

This error indicates that the upstream server cannot carry out your request in time to serve the website’s content.

According to the Internet Engineering Task Force (IETF), the definition of the 504 Gateway Timeout error is as follows:

The 504 (Gateway Timeout) status code indicates that the server while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.

The error may be a temporary occurrence due to too much traffic toward the server or site.

On the other hand, there may be a resource on the website which is taking too long to load, causing the issue. Another possibility is that your computer cannot establish a proper connection to the website due to various reasons.

Common HTTP 504 error message variations

What is a 504 Gateway Timeout error, and how to fix it? (1)

You may stumble upon an HTTP error 504 in different wording formats, yet it all boils down to a server-to-server communication disruption. Here are the most common variations of this error you may encounter:

(Video) 504 Gateway Timeout Error and How to Fix It

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

At times, you may see the error message described in one of the following manners:

  • The page request got canceled because it took too long to complete
  • 504 Gateway Time-out – The server didn’t respond in time
  • This page isn’t working – Domain took too long to respond

Website owners and web hosts can also customize the error 504- gateway timeout page. For example, here is what the custom 504 error page by SiteGround looks like

What is a 504 Gateway Timeout error, and how to fix it? (2)

SEO Impact of the 504 Error

Errors from the 5xx class refer to issues with the server completing a client’s request successfully. Such problems on your website affect user experience, eventually causing damage to your brand’s reputation.

Moreover, Search Engines are keen to take notice of prolonged 504 issues on your website. If Google bots detect that your site is down with a 504 error for too long, you may lose SEO ranking.

Therefore, fixing a 504 Gateway Timeout error on your website is not only crucial but also time-sensitive.

Causes of the 504 Gateway Timeout Error

The 504 Gateway error is usually temporary, and different reasons may cause it. Most often than not, the problem is due to a client-end issue like Internet connection troubles.

However, the hitch may be due to server-to-server network connectivity issues or a server being down. For example, when a server is under maintenance, you would likely see the 504 error on a website hosted there. Once this process is completed, the site should become accessible again.

Other culprits for an HTTP 504 error may be a traffic overload on the server, bugs in the code of a website, or DNS issues.

Additionally, this error can be due to other services acting like proxy servers for a website – CDN services, API gateways, etc.

How to fix 504 Gateway Timeout error

Although this is usually a server-side error, there is a possibility that the issue is on your end. If you see this error while visiting your favorite website, there are a few quick checks you can try to determine whether that is the case.

Refresh the page

As this may be a temporary issue due to too much traffic to the website, it is always helpful to try refreshing the page. To refresh, simply use the F5 button on a Windows machine or the Cmd + R key combination on a macOS. In case it was a temporary error, you should be able to reach the website after reloading the page.

Check your proxy server settings

Many users prefer to browse the Internet via proxy servers to keep their transactions private. Some proxy services may alter your computer’s IP address to hide your original location, while others also encrypt your web requests to keep prying eyes away. Moreover, a proxy server can block access to certain pages by their IP address.

At times, incorrect proxy settings on your computer may lead to 504 timeout errors. That is why it is best to revise yours or disable the proxy server to see if this is the culprit.

(Video) Error 504 - 100% Fix Gateway Timeout Error ⚠️

To disable the proxy settings in Windows 10, click on the Start button and select the gear icon to reach the Settings page. In this menu, you need to find the Network & Internet icon and select Proxy from the left pane.

What is a 504 Gateway Timeout error, and how to fix it? (3)

Some computers do not have Proxy server settings by default, and if yours falls into this category – you may skip this step.

See if the website is down for other people

On some occasions, the site you cannot reach is working perfectly fine for others. Therefore, you may want to check if that is valid in your case, and there are many web tools you can use for this. For example, you can try checking with the popular web tool Is It Down Right Now to see if the site is up and running.

What is a 504 Gateway Timeout error, and how to fix it? (4)

Restart your network devices

If the web tool mentioned above shows that the site is not available just for you, the problem could be on your end. At times, incorrect settings or hardware issues may be causing the HTTP 504 error. That is why you may need to reboot your network devices like your internet router and computer.

Contact the website

In case you are still unable to reach the desired website, you may consider contacting its administrators. If there is a 504 error on the website, they are likely already working on fixing the outage. Alternatively, you may check the website’s social media accounts to see if there is any information on the issue.

Flush your computer’s DNS cache

Let’s say that the website you have just contacted informed you that they changed their domain’s DNS server. However, your PC may be trying to find the site with the old DNS records stored in the Operating System’s DNS cache. Therefore, you can also try to flush your DNS cache to ensure that it is not the source of the HTTP error 504 you are seeing.

Read these detailed articles on how to flush the DNS cache in Windows, Mac OS, or Linux machines.

Contact your ISP

Another step you can take is to contact your Internet service provider (ISP) and see if there are any connectivity issues from their end. Your ISP may be experiencing some service interruptions or doing system maintenance, which may cause a 504 error.

Try again later

As we mentioned earlier, the 504 Gateway Timeout can be just a temporary occurrence. Hence, accessing the same site later may be successful if the issue was just a temporary one.

How to Fix 504 Gateway Timeout on your website

Being a site owner comes with the responsibility to take care of any problems affecting the overall experience of your visitors. As we already mentioned, failing to resolve a 504 timeout on your site in time may impact your SEO. Keep reading to see how to fix a 504 Gateway Timeout error on your website.

DNS issues

When you transfer your website to another web server, you need to change your domain’s DNS records accordingly. Then the domain goes into a propagation period until the DNS change is recognized globally. Your site may start serving an HTTP error 504 to your visitors during that time. To check whether your domain name has propagated globally, you can use a web tool like this DNS Checker.

What is a 504 Gateway Timeout error, and how to fix it? (5)

Disable Your Site’s CDN Temporarily

At times, a CDN service like Cloudflare may not be able to get a timely response from the origin web server. That would result in an HTTP error 504 on your site, and to solve it, you may need to bypass or disable the CDN. You should note that deactivating such services may involve specific DNS changes, which would need some time to take effect.

Thus, you may bypass the CDN to see whether the error comes from the hosting web server or Cloudflare’s end. You can do this by editing your computer’s hosts file and setting your domain to point to the hosting server directly.

(Video) How to fix "504 Gateway Timeout" Error 2022 | 504 Gateway Timeout problem

To do that you can insert a line like the one below into your hosts file instructing your computer to load the site from the origin server.

1.2.3.4 yourdomain.com www.yourdomain.com

Note that you need to replace “1.2.3.4” with the actual server IP for your hosting server and “yourdomain.com” with your actual domain name.

After that, you should clear your browser cache and try reloading the site again. If the site loads normally, the issue is most likely coming from the CDN service.

If that is the case, you can login to your CDN control panel and temporarily disable it.

Check your server logs

If the error is not due to DNS issues with your domain or a CDN service, you may need to check your server logs. Scrubbing through your server logs can help you pinpoint the culprit for a 504 error. SiteGround clients can find the server Error log for their site in the relevant Site Tools > Statistics > Error log.

Spam, Bots, or DDoS Attacks

Your site may be experiencing a 504 Gateway Timeout due to malicious bots crawling your site at excessive rates. They can exhaust your server resources by spawning too many requests toward your site. If your site is under a DDoS attack from bad bots generating abnormal traffic, it will serve an HTTP 504 error.

Analyzing your Access logs may help you spot IP addresses making too many requests to your site. That way, you can block the offending IPs from accessing your website.

Fix HTTP error 504 on WordPress

Popular WordPress sites and online shops tend to experience 504 errors significantly often. Read further to learn the possible causes for such errors and how to address them.

HTTP Timeouts

An HTTP Timeout can happen when you are trying to import files or products into your WordPress website, which takes too long. That could be caused by a slow internet connection, which keeps the client-server connection open for too long.

To resolve this problem, you can switch to a faster connection or use the WP-Cli for the import process. The WordPress Command-line interface allows you to execute the wp import command over SSH, significantly expediting the procedure.

Deactivate your WordPress Firewall

If you are using a security firewall like Sucuri, it is possible that their proxy servers can not establish a proper connection to the origin server. Sucuri WAF has a default timeout set to 180 seconds to protect your site from different attacks. This amount of time is considered enough for a normally functioning application to respond.

However, if the application fails to respond in that time frame, the WAF will serve you a 504 Gateway Timeout. To troubleshoot this problem, you may bypass the firewall or completely disable it.

If you can load your site afterward, the IP addresses of the service could be blocked on the hosting server firewall. Thus, you should get the IPs your firewall is using and check with your hosting provider if these are blocked for any reason.

(Video) How to Fix the 504 Gateway Timeout Error on Your WordPress Site

Even if the issue is not resolved by disabling your firewall, you may at least be able to see the actual error the server is responding with.

Inspect your site’s .htaccess

As an important configuration file, the .htaccess holds directives defining the site’s behavior and restrictions. However, some WordPress plugins insert lines into that file, which causes conflicts resulting in an HTTP 504 error. That is why we highly recommend you to inspect the file and make sure it is correct.

In case you are not sure whether your .htaccess is corrupted, you can rename the file to disable it and create a default one.

You can do that via FTP, SSH, or directly from your hosting’s File manager. The default WordPress .htaccess code for basic WordPress installations is shown in the code block below.

# BEGIN WordPressRewriteEngine OnRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]RewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]# END WordPress

If your website loads properly after the default .htaccess is set, an improper directive was likely causing the 504 error.

Corrupted WordPress Database

The HTTP error 504 may result from a corrupted or not well-optimized WordPress database. To solve this, you can repair and optimize your database from PHPMyAdmin or use a WordPress plugin. Note that you should always take a backup of your database before making any changes.

Check your plugins and themes

Faulty plugins or a broken WordPress theme may cause your website to serve a 504 error. To check whether that is the case, you may try disabling the active plugins on your site and see if that will solve the problem.

If you have access to your WordPress Admin Dashboard, you can disable your plugins directly from the Plugins section.

What is a 504 Gateway Timeout error, and how to fix it? (6)

However, if your Admin Panel is inaccessible, you can disable all plugins at once from your Site Tools > WordPress > Install & Manage. Under the Actions menu, select the Deactivate plugins option.

What is a 504 Gateway Timeout error, and how to fix it? (7)

A more complicated alternative is to disable all WordPress plugins directly from the database.

If disabling the plugins did not help you narrow it down to a conflicting plugin, the issue may be related to the theme of your site. To check this, you can switch to a default WordPress theme from your Dashboard. If your admin area is inaccessible, you can also change your theme from the database using PHPMyAdmin and see if that fixes the 504 Gateway Timeout.

Go through your site’s error log

With WordPress, you can enable the debug mode to log errors, and very often, the entries inside may point you in the right direction. SiteGround servers use the php_errorlog file to store PHP errors, and you can find it in the root folder for your WordPress installation. Looking inside it may give you an idea of what is causing the 504 error on your site.

Contact your hosting provider

Provided that none of the solutions you tried so far worked for your site, you may also contact your hosting provider. There is a good chance that the Support team will help you fix the error 504 or provide you with guidance on troubleshooting it. If you are a SiteGround client, you can reach out to all support channels 24/7.

(Video) 504 Error | How to fix 504 Gateway Timeout Error | 504 That's an Error

Other errors similar to 504 – gateway timeout

The 5xx class of HTTP status codes indicates a problem on the server-side, resulting in an error message on your end. As the 504 Gateway Timeout is a time-response error, others from the 5xx branch point to different server issues.

  • 500 Internal Server Error
  • 502 Bad gateway
  • 503 Service Temporarily Unavailable

To wrap it up, the Gateway Timeout 504 error may be time-consuming to troubleshoot and challenging to solve. With this detailed guide, you will be able to rule out any local causes and investigate server-end issues that may be causing the error for you.

FAQs

What is the reason for 504 Gateway Timeout? ›

The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.

Is a 504 Gateway Timeout my fault? ›

A 504 Gateway Timeout error indicates that the web server is waiting too long to respond from another server and “timing out.” There can be many reasons for this timeout: the other server is not functioning properly, overloaded, or down.

How do I resolve gateway error? ›

In this article, I will show you 4 ways you can fix the 502 bad gateway error so you can access the internet again.
  1. Fix 1: Refresh the Page. ...
  2. Fix 2: Try to Access the Website on another Device. ...
  3. Fix 3: Switch to another Browser. ...
  4. Fix 4: Clear your Browser Cache. ...
  5. Fix 5: Flush your DNS Cache. ...
  6. Conclusion.
22 Apr 2022

Why do I keep getting gateway error? ›

A 502 bad gateway message indicates that one server got an invalid response from another. In essence, you've connected with some kind of interim device (like an edge server) that should fetch all of the bits you need to load the page. Something about that process went wrong, and the message indicates the problem.

How long does a 504 Gateway Timeout mean? ›

DNS Changes

This could cause your website to serve its visitors a 504 Gateway Timeout Error page. Your website won't be up and running until these DNS changes take full effect, which can take a few hours.

How do I get rid of connection timeout? ›

  1. Causes of Connection Timed Out Error.
  2. Method 1: Try VPN.
  3. Method 2: Flush DNS Cache.
  4. Method 3: Check Your Connection.
  5. Method 4: Clear Cache Memory.
  6. Method 5: Renew DNS.
  7. Method 6: Update Network Adapter Driver.
  8. Method 7: Run Network Troubleshooter.
25 Oct 2022

How do I fix my timeout? ›

How to Fix the ERR_CONNECTION_TIMED_OUT Error?
  1. Solution 1: Restart Your Internet Connection. ...
  2. Solution 2: Disable Your Firewall and Antivirus Software. ...
  3. Solution 3: Disable Proxy Server Settings or VPN. ...
  4. Solution 4: Clear Browser Cache. ...
  5. Solution 5: Change the DNS Server. ...
  6. Solution 6: Flush Out and Renew DNS.
3 Feb 2022

Why do I keep getting timeout errors? ›

If the server takes so long to respond, a timeout error displays. This error is meant to prevent devices from waiting ceaselessly for the server to respond. The possible causes may be a server issue, outdated browser and cache, blacklisted sites, sporadic internet connection, faulty extensions, etc.

How do I reset my IP gateway? ›

How to Reset IP Address On Windows computer?
  1. You have to first click on the Start > Run. ...
  2. Now you have to type the command of ipconfig /release and then press Enter.
  3. Now you have to type the command of ipconfig /renew and then press Enter.
24 Jan 2020

How do I unblock my gateway? ›

Uncheck the Use default gateway on remote network option, close the dialog, and then select Security. Check the option, Use clear text terminal login. Again, this option is ISP-specific, but most ISPs use terminal logins. Now you have to make your system forward IP packets.

How do I reset my network gateway? ›

Reset gateway
  1. Press and hold the gateway Reset button for at least 10 seconds. If you let go before 10 seconds, the gateway will reboot, but it won't reset.
  2. Wait until the gateway restarts and all the status lights are lit.
  3. See if the Broadband or Service status lights are solid green. If so, the reset worked.
30 Jun 2022

Videos

1. How to Fix Error 504 and 502 Bad Gateway in Windows 10/8/7 | Solutions 2020
(SP SKYWARDS)
2. 504 Gateway Timeout Error - How to Fix 504 Gateway Timeout Error
(WEB SOLUTIONS)
3. Why is Canva not working? what does bad gateway mean, 504 gateway time out
(iZem)
4. Error 504 Gateway timeout resolved.
(gossipfunda)
5. 504 Gateway timeout problem solved | with live proof!!
(Informing Zone)
6. How to Fix 504 Error and 502 Error Bad Gateway Timeout [Solution 2022]
(Estefy)
Top Articles
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated: 11/30/2022

Views: 6060

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.