How to Fix the 504 Gateway Timeout Error
A 504 Gateway Timeout error is one of most common HTTP server error responses you’ll find. In this case, it’s because a server doesn’t get a response in time from another (‘upstream’) server. As such, there isn’t a lot you can do from the client side in order to solve this one.
However, there are a few aspects to check over to make sure that both client and server are as you’d expect them to be:
- You can carry out a number of basic checks, both on the client-side (such as reloading the page, disabling your proxy server, and more), and the server-side (such as checking your plugins’ status).
- You might resolve the error through flushing out the local Domain Name System (DNS) cache.
- In some cases, you’ll see errors if your WordPress database is corrupt. As such, you’ll want to carry out a repair.
Most of the time, the issue will be to wait things out if you don’t run the site. If you do, and the below doesn’t help you out, you should contact your host. They will be able to help right your ship again.
1. Carry Out Some Basic Checks
Whenever you encounter any error, the first step you should take is to carry out some basic resets. After all, the trope of turning things off and on again exists for a reason.
As such, you’ll want to make sure you apply any and all of the following:
- Reload the page from the browser.
- Reboot any network devices you use.
- Check that you aren’t the recipient of malicious intent, such as a hack attempt
- Make sure your plugins don’t introduce errors to your site.
- If you use a proxy to browse the net, or a Virtual Private Network (VPN), you can disable it on a temporary basis.
- Also, you could look to disable your Content Delivery Network (CDN) for a few moments too if you use one for your site.
- Set up WordPress’ debug mode and check your error logs.
This is a long list of simple checks. However, they can all cause issues such as the 504 Gateway Timeout error. Once you tick off these fixes though, it’s time to look into more advanced solutions.
2. Fix Any Client-Side DNS Issues
The DNS is the backbone of browsing the web. In a nutshell, it links server IP addresses to readable domain names. As a result, it can also cause errors if those DNS attributes and values don’t ‘propagate’ as they should. The 504 Gateway Timeout error could be one of them.
You can check whether a website’s DNS is present and correct through any number of websites. For example, WhatsMyDNS is a popular lookup website that lets you plug in a domain name and see the DNS status for each server that hosts it:
Your local computer also has a DNS cache, to help speed up the loading time for sites you browse to on a regular basis. You’re able to flush this out with relative ease. In fact, we cover this in another Design Bombs article with depth.
While this won’t always solve the 504 Gateway Timeout error, it can give you some insight into whether the client- or server-side is falling down.
3. Repair Your WordPress Database
If a site is offline, it makes sense that there could be a database issue. As such, you’ll want to check that your site’s own database isn’t a cause for the 504 Gateway Timeout error.
However, you’ll also want to check out the in-depth guide on WPKube to repair your database. This takes a deep dive into how to recognize an error, and how to fix it. There are different solutions based on your level of experience and preferred method, such as using code, logging into the database using the WP-CLI, and using a tool such as Adminer.
Waiting for a site to load is one perennial issue, which is still a problem even for the modern web. However, in the case of the 504 Gateway Timeout error, performance isn’t an issue: It’s the server itself. As such, there are a few ways to put things right.
If you browse to a site and see the error, the best option is to wait for things to pass. However, if you run a site and see the error, you can try to flush out your DNS cache, repair a broken WordPress database, and carry out some simple checks.
Do you have a question about the 504 Gateway Timeout error? Let us know in the comments section below!