This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

✨ Vultr and Linode are back on Cloudways! VIEW PLANS→

How to Fix the 504 Bad Gateway Timeout Error

Updated on September 18, 2023

9 Min Read
fix 504 gateway timeout error in wordpress

Ever been stuck with the annoying 504 error? We know it can be quite frustrating.

Running into the 504 gateway timeout error can bump your browsing journey. But don’t worry, it’s a common problem many face and is fixable.

In this blog, we will break down the 504 error in the simplest terms and give you easy-to-follow steps to fix it and get back to your smooth browsing experience.

We will also list the steps to prevent the occurrence of 504 errors in the first place. Let’s dive in.

What Is the 504 Gateway Timeout Error?

The 504 gateway timeout error is an HTTP status code that is returned when the server involved in the route of fetching the requested data does not get a timely response from another server, thus interrupting the request completion.

In simpler terms, a 504 error basically means that one of the servers in the network didn’t respond in the expected time, and the request sent by your browser was not returned.

504 Gateway Timeout Error

Facing persistent 504 errors?

With Cloudways’ optimized configurations and proactive server management, you can prevent gateway timeout issues.

504 Gateway Timeout Error: Different Variations

The 504 Gateway timeout error can come up in different ways depending on the operating system, web server, and browser being used. Regardless of the wording, whenever you see the following error codes, just know that the server response is delayed.

The 504 error may occur in the following variations:

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

What Causes the 504 Error?

The 504 error usually occurs on the server side, but client-side problems can sometimes also trigger this error. Here are some of the common causes:

  • Timeout from upstream servers
  • Server overload
  • Network issues
  • Incorrect server settings or configurations
  • Server facing downtime, or if it’s under maintenance
  • Faulty PHP scripts
  • Firewall blockages
  • Content Delivery Network (CDN) and Domain Name System (DNS) issues
  • Plugin conflict

How to Fix the 504 Gateway Timeout Error (Client Side & Server Side)

Now that you know the causes of the 504 error, here are some fixes that will help you get rid of this error. I have divided the solutions into two broad categories: client-side errors and server-side errors.

Tired of the dreaded 504 errors?

With Cloudways’ Managed WordPress Hosting, enjoy error-free hosting and stellar uptime.

Solving Client-Side 504 Error

As established above, you cannot exactly figure out what is causing this error to occur. You need to take the steps to see what resolves it. Firstly, you should try resolving the client-side errors to rule out the possibility that you might be causing this issue.

  1. Reload the Web Page

The first hack to resolve this issue is quite simple. All you need to do is to try reloading the page.

To do that;

  • Press the F5 keyboard shortcut to refresh/reload the web page.
  • You also need to remove the browser cache before reloading the page. To do that, press CTRL+F5 shortcut.
  • Or simply click the reload button.

Reload the Web Page

  1. Reset Your Router

If reloading doesn’t work, try resetting your router. You might be facing network connectivity issues, leading to the 504 error.

  1. Try a Different Browser

If resetting your router didnt work, you should try a different browser. Maybe using the incognito mode. If that doesn’t work either, try switching to a different browser.

  1. Try a Different Device

To rule out any possibility of client-side error, you can also try loading the same page on a different device. It can be your phone, another laptop, or a tablet.

  1. Cross-Check Your Proxy Settings

You might have enabled the proxy settings on your device to enhance online privacy by hiding private data from websites and web servers. Since the proxy server sits between your device and the internet, it can cause the 504 error to show up.

With that said, it is unlikely for proxy servers to cause a 504 error, but incorrect settings can sometimes play a part in it. To rule out this possibility:

  • Go to your system settings
  • Select Network and Internet > Proxy
  • Disable the Proxy Server

Disable the Proxy Server

  • Once done, try reloading the page.

Solving Server-Side 504 Error

If the issue persists, then it’s certain that the server is causing this error.  Here’s how you can fix it;

  1. Flush DNS

Sometimes the outdated DNS records on your local machine can cause the 504 error. Hence, if this is the issue, you need to clear the DNS to ensure that your computer performs fresh lookups, instead of relying on potentially outdated or corrupted cache data.

To flush the DNS, you need to open the command prompt and type the following commands depending on the operating system you are using;

For Windows:

  • Press the Windows + R keys simultaneously.
  • Type cmd and press Enter
  • Add the following command;

For Windows

For macOS

  • Open the terminal by going to Applications > Utilities
  • Enter the following commands. The commands would vary depending on the versions.
Version Command
For macOS Sierra and above sudo killall -HUP mDNSResponder
For macOS Yosemite v10.10 to v10.10.3 sudo discoveryutil mdnsflushcache
For macOS Mavericks, Mountain Lion, and Lion sudo killall -HUP mDNSResponder
For macOS Snow Leopard sudo dscacheutil -flushcache

For Linux

For linux, open the terminal and write the following command;

For Linux

After flushing the DNS cache, restarting your web browser or even your computer might be a good idea to ensure all applications use the fresh DNS data.

  1. Check the Error Log

Error logs can help you to troubleshoot and debug the 504 errors on your site. By checking the error log, you can narrow down the issue of your site and can find out the problematic area.

If you’re a cloudways customer, you can check the error log simply by following these steps;

  • Go to Application settings > Monitoring
  • ‘Select Logs > Error Logs

Error Logs

  • check the error log to see if some of the themes or plugins are wasting memory space and causing this issue. This isn’t a common cause, but it’s possible for a malfunctioning plugin to slow down the server so it cannot respond in the expected time.
  1. Deactivate your CDN

If you suspect that your Content Delivery Network (CDN) might cause the 504 Gateway Timeout Error, temporarily deactivating or bypassing the CDN can be a useful troubleshooting step.

Being a cloudways customer, it is a one-step process to delete the CDN.

  • Go to the application backend.
  • Under the application settings > Cloudflare
  • Click on Delete Domain

Click on Delete Domain

  • Just click unsubscribe and you’re done

 click unsubscribe

  • This will disable Cloudflare integration from your application.

disable Cloudflare integration

Boost your site’s resilience against pesky 504 errors!

Leverage Cloudways’ integration with Cloudflare for faster, more reliable performance and keep gateway timeouts at bay.

  1. Check the Plugins

The next step in line is to check the plugins. checking the plugins is a vital step in resolving the 504 Gateway Timeout Error because plugins can introduce a variety of issues, from conflicts and resource consumption to security vulnerabilities. Identifying and resolving plugin issues can often resolve the 504 error, restoring your website to normal functionality. 

You can temporarily deactivate all plugins and then reactivate them one by one can help identify the problematic plugin causing the error. Here is how you can deactivate the plugins;

  • Go to your WordPress admin Dashboard
  • Select plugins > installed plugins
  • Click on deactivate

deactivate plugins

  1. Check with your Hosting Provider

If the standard troubleshooting steps fail to resolve the issue, then you must check with your hosting provider for the solution. WordPress hosting providers house teams of experts with the right skill set to diagnose and address such errors quickly. Moreover, they also  have insights into the current status of the servers and can quickly check if there is an issue with the server itself.

If you’re a cloudways customer, you don’t need to worry about anything. Cloudways is well-known for its excellent support. The Cloudways support team combines expertise, technology, and a client-centric approach to offer an efficient resolution to issues like the 504 Gateway Timeout Error, making them an ideal choice for resolving such errors promptly and efficiently.

How Does the 504 Error Impact SEO?

The 504 gateway timeout error can spell trouble for your site’s SEO. Firstly, it often increases the bounce rate as frustrated users leave due to a poor experience. Secondly, the error’s downtime negatively impacts both user access and search engine indexing.

Slow loading times, resulting from 504 errors, send unfavorable signals to search engines, potentially lowering your site’s ranking. Also, if this error occurs persistently, it may even lead to pages being removed from search engine results, known as de-indexation. Moreover, search engines may allocate fewer resources to crawling your site, hindering future visibility.

So, it is highly crucial to promptly address and resolve the 504 error to safeguard your website’s SEO.

Pick the Right Hosting Provider to Minimize the 504 Error

Selecting the right hosting provider is important to keeping the pesky 504 errors away and ensuring a smooth online experience for your users.

When you opt for a hosting provider that prioritizes uptime and site performance, you reduce the risk of encountering the 504 error. But how do you pick the right hosting provider? Here’s how:

  • Firstly, check for a hosting provider with top-notch infrastructure, including efficient data centers, reliable network connections, and robust server hardware. This foundation sets the stage for a stable website.
  • Secondly, opt for a hosting provider that offers easy server scalability and configuration flexibility, allowing your site to grow seamlessly as your needs evolve.
  • Furthermore, ensure your chosen provider regularly maintains and updates server software and hardware to prevent persistent errors. Also, your chosen hosting provider should offer exceptional technical support to assist you promptly if issues arise.
  • Lastly, prioritize hosting providers with high uptime and consider those offering Content Delivery Network (CDN) integration.

Making these informed choices can significantly enhance your website’s performance and keep errors like the 504 errors at bay.

Considering the above criteria, Cloudways is one managed hosting provider that checkmarks all these requirements.

  • Cloudways offers 99% uptime, reducing the chances of your server going down and hence strengthening it against the 504 error.

Our team tested a site’s performance and compared it with the results of Kinsta and WPengine. The result? Cloudways gave significantly better results in terms of monthly visits, bandwidth, and storage.

monthly visits, bandwidth, and storage.

  • Cloudways uses top cloud infrastructure providers such as AWS, Google Cloud, and DigitalOcean to ensure stable and reliable server performance, and its optimized stack ensures that the sites are always up and working.
  • With Cloudways, you get dedicated server resources that help handle traffic spikes more efficiently and prevent server overloads, which can lead to 504 errors.
  • Cloudways offers integration with Cloudflare CDN solution that aids in faster content delivery, reducing server load and consequently lowering the risk of 504 errors.
  • You get real-time monitoring tools allowing you to closely monitor server health and resource utilization, enabling timely interventions to prevent 504 errors.
  • Cloudways offers 24/7 expert support, ensuring quick resolution of issues, including 504 errors, to maintain the site’s uptime.
  • You also get easy vertical scaling options to quickly increase server resources during traffic surges, preventing server overloads and 504 errors. Also, Cloudways lets you scale your server horizontally to distribute traffic across multiple servers.

Summary

This blog discussed everything about the 504 errors, exploring them comprehensively and offering effective solutions. The 504 error can frustrate users and harm your website’s search engine optimization (SEO) efforts. However, the practical solutions listed in this blog can help you combat these errors in real time.

But surely prevention is better than cure. So, one should take all the right approaches to prevent the 504 error from occurring in the first place. And it all depends upon making the right decisions, such as selecting the ideal hosting solution to eliminate 504 errors proactively.

Should you have any further inquiries, please don’t hesitate to get in touch. You can also find detailed guides on other WordPress errors like 500 internal server error, 404 error or 403 forbidden error.

Frequently Asked Questions

Why am I getting a 504 error?

You usually get a 504 error when your server, acting as a gateway, doesn’t receive a timely response from another server.

How do I fix the 504 error in WordPress?

To fix a 504 error in WordPress, check your server’s connectivity, deactivate problematic plugins, and ensure your server has enough resources to handle requests.

How do I prevent 504 errors?

To prevent 504 errors, follow these best practices:

  • Keep server and applications updated
  • Optimize website speed
  • Adjust server timeout settings
  • Implement a Content Delivery Network (CDN)
  • Consistently monitor server health

Can you monitor the 504 Gateway timeout error?

Yes, you can monitor 504 Gateway Timeout errors using website monitoring tools that alert you to downtime or connectivity issues.

 

Share your opinion in the comment section. COMMENT NOW

Share This Article

Liza Rajput

Liza Rajput is a Technical Content Producer at Cloudways. Being a software engineer, she loves to play with data and its processes and wishes to grow and excel in Data Science and Big Data Engineering. She has also been an avid reader and exceptional writer, with sufficient experience in technical, research-based, and creative writing.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now