Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Fix the 504 Gateway Timeout Error in WordPress

We’ve seen the 504 Gateway Timeout error a lot of times, and you probably have, too.

It’s one of those frustrating issues that can make your entire WordPress site inaccessible. What’s worse, this error has a habit of playing hide-and-seek – disappearing and reappearing if you don’t address the root cause.

In this comprehensive guide, we’ll walk you through how to fix the 504 Gateway Timeout error in WordPress. 

Fixing 504 gateway timeout error in WordPress

What Is the 504 Gateway Timeout Error?

The 504 Gateway Timeout error happens when a website’s main server, which handles the visitor’s request to open the page, doesn’t get a quick response from the upstream server.

The upstream server may be busy or dealing with high traffic, causing a delay. In simpler terms, it’s like your request is waiting for information from another part of the website, but that part is too busy to respond promptly.

If you are using a website firewall and it is unable to connect to your WordPress web server, then you may also see a 504 gateway timeout error.

504 Gateway timeout error

The error page’s appearance and the message may look different depending on your WordPress hosting company, the proxy server, or the web browser you are using.

Here are some of the most common 504 gateway timeout error messages:

  • 504 Gateway Timeout
  • HTTP 504
  • 504 ERROR
  • Gateway Timeout (504)
  • HTTP Error 504 – Gateway Timeout
  • Gateway Timeout Error
  • Connection timed out (504)
  • This site is experiencing technical difficulties (504)
  • Gateway Timeout: The server didn’t respond in time
  • The request timed out while connecting to the upstream server (504)

While the most common reason for the error is a proxy server unable to reach the upstream server, it can also be triggered by other hosting configuration issues.

🚨 Is your WordPress site giving you headaches? At WPBeginner Pro Services, we offer comprehensive WordPress maintenance. From keeping an eye on your site’s uptime to securing your data with cloud backups and tackling pesky malware, we’ve got you covered. Let our WordPress experts diagnose and fix your site’s issues.

Book a FREE Consultation Call Now and breathe easy!

That being said, let’s see how to easily troubleshoot and fix the 504 gateway timeout error in WordPress:

1. Wait and Reload the Page

Sometimes, the 504 gateway timeout error code may simply be caused by connectivity issues on your WordPress hosting servers. Give it a few minutes, and then try reloading your WordPress website.

In some cases, you may also want to try clearing your browser cache and refresh the page again.

If the issue disappears, then you don’t need to take any further steps. However, if the error persists or reappears after a while, then continue reading to troubleshoot and fix the problem.

2. Turn Off the VPN

If you are using a VPN service to browse the web, then you can try disabling it.

Turn off VPN

Sometimes, your VPN server may not be able to get a response from your managed WordPress hosting server, and this will result in a 504 gateway timeout error.

If your website reappears, then this means that the VPN server is the culprit.

If using the VPN is important for you, then you can try switching to a different VPN server. However, if you see the error even after changing servers, then you will need to contact your VPN service provider for support.

3. Turn Off Your Website Firewall

If you are using a DNS-level website firewall like Sucuri or Cloudflare, then try to temporarily disable the firewall. This will allow you to connect to your WordPress hosting server directly.

Sucuri 504 error

If that fixes the issue, then your hosting server is likely blocking the firewall IP addresses, which can cause this issue. You will need to contact your firewall service provider to get their list of IP addresses and then contact your web host to whitelist those IPs.

Sometimes, disabling the firewall might show you the actual server error notice. In that case, you should refer to our list of common WordPress errors to fix the specific issue.

4. Disable Your Network Proxy

If you are connected to the internet through a proxy server, then that server may be unable to get a response from your WordPress website.

Try accessing your website using a different internet connection or a different browser. Alternatively, use online services to see if your website is down just for you or everyone.

If it is down just for you, then you will need to change your network connectivity settings. You can contact your internet service provider or a network admin to troubleshoot the issue for you.

5. Change Your DNS Servers

Your internet connection uses something called DNS servers. These servers help your computer connect to the different servers on the internet.

If there are DNS issues, like the servers you’re using are down, then you could see a 504 gateway timeout error. The easiest way to check this is by changing the DNS servers your device is using.

On Windows computers, you can find them by going to Control Panel » Network and Internet » Network and Sharing Center » Change adapter settings.

Then, click on your network, select ‘Change settings of this connection’, and choose ‘Internet Protocol Version 4’ from the dropdown menu. You can now manually enter DNS server addresses.

Changing DNS servers in Windows

On Mac computers, you can find DNS settings by going to Settings » Network.

Click on the ‘Advanced’ button, and then select the ‘DNS’ tab.

DNS settings on Mac

We recommend changing your DNS server address to 8.8.8.8 and 8.8.4.4 and applying the changes.

Try visiting your website again. If this solves your error, then you are all done. The problem was with your internet connection, and it is now fixed.

6. Clean Up Your WordPress Database

A corrupt WordPress database may also trigger a 504 gateway timeout error. Don’t worry, your WordPress data is most likely safe. However, your database may need a little bit of spring cleaning.

This can be easily done by optimizing your WordPress database using phpMyAdmin or using a plugin like WP-Sweep.

Just make sure to back up the WordPress database before making any changes.

7. Deactivate WordPress Plugins and Switch to a Default Theme

WordPress plugins and themes are less likely to cause a 504 gateway timeout error. However, if a plugin or theme is making too many requests to the server, then some of these requests may drop off and trigger a 504 gateway timeout error.

To test this, you need to deactivate all WordPress plugins via FTP.

Deactivate all WordPress plugins

After that, visit your website to see if the error has been resolved.

If it is, then one of your plugins was causing the issue. You now need to activate all plugins one by one until you can reproduce the error. This will help you locate the plugin responsible for the error.

If deactivating plugins didn’t solve your issue, then you would want to check your WordPress theme. You will need to switch your WordPress theme via phpMyAdmin.

After switching your theme to the default WordPress theme, you need to visit your website to see if it’s working. If it is, then your original theme was the problem.

Should all else fail, consider updating your WordPress and your PHP version.

8. Turn Off Your Content Delivery Network (CDN)

A content delivery network (CDN) can sometimes be the culprit behind the 504 gateway timeout error. This is a pretty rare occurrence, but if one of the servers in the CDN is down, the issue may occur.

You can temporarily disable the CDN and see if this is true. This process will vary depending on which service you are using.

For more information about CDNs, you can check out our tutorial on configuring CDNs in WordPress.

9. Check Your DNS Status

This step is more applicable if you’ve just migrated to a new hosting provider and updated your website’s DNS settings.

After moving your website to a new host, you have to make your current domain name point to the new hosting account by updating its DNS nameservers. Then, you have to wait up to 48 hours for the changes the propagate for all users.

During this propagation period, your site may experience a short downtime, which can cause users to see a 504 gateway timeout error.

To confirm if your DNS settings are the problem, you can use a tool like DNS Checker. For more information about DNS updates, read our guide about clearing the DNS cache.

10. Check for PHP Timeout Errors

The 504 gateway timeout error can sometimes be caused by a low PHP timeout limit set on your server.

This limit essentially defines the maximum amount of time a script on your website has to execute before timing out. If a complex script or database query takes longer than this limit, it can trigger the error.

To fix this issue, you can check out our guide on how to fix Fatal error: Maximum execution time exceeded in WordPress.

11. Contact Your WordPress Hosting Provider

Finally, as a last resort, you can reach out to your WordPress hosting provider for support. They may be able to fix the issue or point you in the right direction.

They may also be able to show you your server’s error logs. These logs might reveal specific details about the timeout error, helping pinpoint the root cause.

For more information, check out our guide on how to properly ask for WordPress support.

If you are still unable to solve the 504 gateway timeout error, then try following the steps in our ultimate WordPress troubleshooting guide for beginners.

Or, check out WPBeginner Pro Services’ emergency WordPress support. We’ll quickly investigate your site, pinpoint the issue’s source, and implement a tailored solution to get you back online.

Don’t let WordPress problems keep you up at night. Take advantage of our free consultation and let our experts resolve your site’s issues today.

Emergency WordPress Support

We hope this article helped you learn how to fix the 504 gateway timeout error in WordPress. You may also want to see our ultimate list of the most common block editor problems and our guide on how to get email alerts on WordPress 404 errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

11 CommentsLeave a Reply

  1. Jiří Vaněk

    I occasionally encounter this problem with CloudFlare, and I haven’t yet managed to figure out exactly what causes it. Whether it’s an issue on my side or CloudFlare’s side. It happens about once every six months, but it’s quite annoying. One of your tips has always helped me: temporarily disabling the CDN provided by CloudFlare. After re-enabling the CDN after some time (usually about an hour), everything works smoothly again. So thank you for the tip; it works for me.

  2. Dennis Muthomi

    I have a question about #5 – Change Your DNS Servers, in that section you mentioned that we should use 8.8.8.8 and 8.8.4.4 specifically.
    Now why not any other numbers? What makes them special?

    • WPBeginner Support

      Those are the numbers for Google’s DNS. :)

      Admin

  3. ShabazRaymond

    I actually had to clear my browser cache. I use Chrome and it saves a lot of my data. That did the trick for me!

    • WPBeginner Support

      Thanks for sharing what solved the issue for you :)

      Admin

  4. cain

    Hi,

    I get the error as I try to update my themes. I tried all the suggestions but nothing works. Please help.

    • WPBeginner Support

      Have you informed your hosting provider about this error for them to take a look?

      Admin

  5. Nitesh Patel

    Great articles as always.

    Do you think there is an advantage in having a custom 504 error page when these issues occur and, if so, how would one go about doing that in WordPress. For example, when an error occurs that invokes the 504 error message, a user sees a Under Maintenance page.

    Many thanks in advance

    • WPBeginner Support

      Hi Nitesh,

      It depends on what triggered the error. For example, if the error occurred while the request reached your server but couldn’t fetch the page then sure you can display a custom error page.

      However, most of the time the error occurs before request reaches your server in that case a browser’s error page is shown or the proxy server’s error page is displayed on screen.

      Admin

      • Nitesh

        Thank you for the great reply. Really appreciate it.

        I suspected that would be the case. Really interesting and to explore new possible options for the future.

        I’m sure you’ve heard this before, but keep up the amazing work. All of us in the WordPress community really appreciate the wonderful work and support you provide on this site and through e.g. Facebook.

        Kind Regards,

        Nitesh

        • WPBeginner Support

          Hey Nitesh,

          Glad to help. We really appreciate your kind words and feedback, thank you for your support.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.