504 Gateway Timeout Errors aren’t good for business. They mean your site isn’t loading and that doesn’t just hurt visits and sales, it can impact SEO, too. The solution? There are quick and simple fixes, and where those fail more complex remedies.
In this blog, I’ll unpack what you need to know about 504 Gateway Timeout Errors. We’ll look at what they are, their causes, and how to diagnose them.
What is a 504 Gateway Error and How Do You Fix It?:
What is a 504 Gateway Timeout Error?
Website-user interaction is based on a very simple formula. You type a domain into an address bar or click on a link and the site loads. On a more granular level, a site visit involves a little more. When you initiate a website visit, your browser sends a request to the server hosting the site you want to visit.
A 504 gateway timeout error is a message that appears when a site cannot load due to a server-to-server communication issue.
What Causes a 504 Gateway Timeout Error?
504 gateway errors are a result of a delay in server-to-server communication. When a request is made to visit a site, it moves from one webserver to another. The request is sent upstream to the server that hosts the website. When the upstream server takes too long to respond, the downstream server presents the 504 error message.
It’s important to note that while 504 errors involve user devices, user devices are rarely the reason for the error unless the device doesn’t have an internet connection or has an unstable one.
504 Gateway Timeout Errors are often also related to an influx in web traffic that upstream servers can’t handle. When they become overloaded, they crash. Servers can also suffer other ailments that prevent them from functioning optimally, therefore presenting 504 errors.
The Class of 500 Errors
The 504 gateway timeout error is one of 11 and belongs to a class of 5xx status codes. These include:
1. 500 Internal Server Error
A 500 Internal Server Error response is a generic error code. It acts as a placeholder for error codes that can’t be assigned to a specific issue.
2. 501 Not Implemented
501 responses show when a server doesn't fulfill a request or can’t recognize the method through which the request is sent.
3. 502 Bad Gateway
502 Bad Gateway error codes are used when a server acting as a proxy server or gateway receives an invalid reply from the upstream server.
4. 503 Service Unavailable
503 “server is unavailable” errors are due to overloaded or scheduled maintenance.
5. 505 HTTP Version Not Supported
505 errors occur when a server doesn’t support the HTTP protocol version used to lookup a website.
6. 506 Variant Also Negotiates (RFC 2295)
506 errors take place when transparent content negotiation for a request results in circular references. The request causes a loop that returns the error.
7. 507 Insufficient Storage (WebDAV; RFC 4918)
507 errors are a result of server-side failure to store the representation that is needed to complete a request, a 507 Insufficient Storage response results. This can be related to low disk space or RAM on the server. On WordPress websites, this error can be due to plugins that need an update.
8. 508 Loop Detected (WebDAV; RFC 5842)
508 Loop Detected errors mean a server has encountered an immeasurable loop while handling your request.
9. 510 Not Extended (RFC 2774)
A 510 error response appears when additional extensions are required for the server to return a request.
10. 511 Network Authentication Required (RFC 6585)
511 error codes are authentication-related. These point to a client being required to prove authentication to gain access to a site.
The Many Faces of the 504 Gateway Error
504 gateway errors often appear with different names given the variety of browsers and operating systems, server and server software available today. It’s possible that you may have seen one of the following:
“504 Gateway Timeout”
“NGINX 504 Gateway Timeout”
“504 Gateway Timeout NGINX”
“Gateway Timeout Error”
How 504 Gateway Timeout Errors Influence SEO
SEO is about optimizing websites and web pages to return content that best answers a user’s question. And because 504 Gateway Timeout Errors cause downtime, they can negatively influence your SEO rankings.
When 504 errors occur, search engine spiders that constantly scour the net can’t get to your site. To spiders, your site appears to no longer be available. Most 504 errors are temporary and therefore have very little to no impact on a site’s SEO. These cases are also handled with cached pages from your site, so people can still access information. But in dire cases, where sites are down for more than 6 or more hours, your SEO will take a hit.
How do I Fix a 504 Gateway Error?
504 errors are often short-lived. Before we dive into more complex 504 error fixes, it’s a good idea to start with light work. The fixes? First, refresh your browser. Use the F5 button to ensure a server-side refresh and not a cache refresh takes place. If your receive the same error, try visiting a different site to ensure it isn’t your internet connection.
Try using mobile data. Your Internet Service Provider can be the reason for connectivity issues. To test yours, log off your WiFi and try and visit your site using mobile data.
Rebooting your modem and other network devices like repeaters is also a good idea. These sometimes can be responsible for poor internet connectivity. If your network devices aren't the problem, it’s time to dig deeper.
Given that 504 errors are mostly server-side issues, I’ll cover a basic step-by-step troubleshooting framework you can use. It will cover connectivity, DNS gremlins, scrutinizing server logs and firewall configs, and website bugs.
Let’s get started.
Is your server down?
Today, it’s not uncommon for a site to live on more than one server. And when 504 errors occur, they can be a temporary issue. To figure out whether your site is down due to a server outage, visit your hosting provider’s site. Typically, hosting providers show server statuses and you’ll be able to tell if yours is down and why.
Has your DNS recently changed?
DNS changes mean your sites moved from one server to another. While it’s rare that a hosting company will make a move like that without proper planning or notice, it can happen. Another DNS-related case could be a change you’ve made.
DNS updates, unlike web page updates, take time. Typically, you’ll have to wait for 24 to 48 hours for the domain to propagate and become available.
What do your logs show?
Server logs are a play-by-play record of all activities that take place on your site. They include web page visits, IP addresses of visitors, types of devices they use, pages that referred a visitor, and a code if a web page was not found.
Combing through server logs may not sound like fun, but can be helpful. For example, they can show any sudden spikes in web traffic and where it’s coming from, something that could help you better manage traffic flow and ease the burden on your site and server.
Have your firewall configurations changed?
Firewalls act as your website’s line of defense. And while sophisticated, they still require human interaction to manage updates to firmware and software. It does, on occasion, happen that buddy updates wipe previous settings. When you review your firewall, you should be able to review updates applied, and if need be, roll back your last firewall profile.
Sifting through website code to spot errors sounds painful, but it’s necessary. To get to your code, you’ll need to FTP to your site using a client.
It’s likely not your CDN
While it may be considered, CDNs are seldom the reason for a 504 Error. As you can see in the image below, this example from Cloud flare shows that the broken link is the web server hosting the site.
In the rare case that it is a Cloud flare - related outage, you’d see this:
CDN teams are typically highly responsive and working on the issue. If you’d like to check up on it, visit your CDN provider’s website for a network status update.
Final Words: Start With The Easy Stuff
504 Gateway Timeout Errors aren’t fun but there’s a good chance that you won’t need to do any heavy lifting to see your site come back to life. Start with a simple browser refresh. If that doesn’t work, head over to your hosting and CDN provider sites for a network status update. If those don’t appear to be the cause, then dig deeper.