Fixing 504 Gateway Timeout: 9 Quick Solutions (2024)

For WordPress website owners, professional website administrators, and website developers, there are plenty of common WordPress errors to keep in mind.

Thinking about error codes may seem overwhelming and maybe even a touch pessimistic. However, we find that proactively cataloging why each one happens and how to fix them saves you a ton of time, money, and brain cells on demystifying the blank or frozen screen in front of you.

After all, how much easier would life be if you came with a message like Error ⒡00ⓓ: Hangry to decode why you’re so snarky over Slack at 3 PM every day? (Guilty!)

Everyone who works with a WordPress website — or has used the internet for that matter — has probably encountered the 504 Gateway Timeout error at some point.

So we put together this guide to explain what you’re looking at, why it happens, lots of solutions for fixing it, and why it even matters that this error occurs in the first place.

From basic checks, all the way through advanced troubleshooting techniques, come along as we wind through everything the savvy website owner or manager should know about fixing the 504 Gateway Timeout error.

Table of Contents

  • How To Identify A 504 Gateway Timeout Error
  • What The 504 Gateway Timeout Error Means
  • What Causes The 504 Gateway Timeout?
  • Why Fix The 504 Gateway Timeout Error?
  • How To Fix The 504 Gateway Timeout Error (9 Possibilities)

How To Identify A 504 Gateway Timeout Error

On the world’s most popular browser, Google Chrome, you’ll often see the familiar “This site can’t be reached” message on a mostly blank screen, with the error code “HTTP ERROR 504” beneath it.

However, there are several different ways this error can be referenced on Chrome, as well as across different browsers, devices, operating systems, server types, and programs.

Fixing 504 Gateway Timeout: 9 Quick Solutions (1)

So, if you see any of these messages, you’re likely dealing with the same 504 Gateway Timeout error we’re talking about today:

  • “Gateway Timeout Error”
  • “504 Gateway Time-out. The server didn’t respond in time.”
  • “Gateway Timeout (504)”
  • “Error 504”
  • “504 Error”
  • “HTTP Error 504”
  • “HTTP 504”
  • “HTTP Error 504. Gateway Timeout.”
  • “504 Gateway Timeout NGINX”
  • “NGINX 504 Gateway Timeout”

And sometimes, the error may be a little less descriptive, forgoing the number code for a reference to timing instead, such as:

  • “This page isn’t working. Domain took too long to respond.”
  • “The page request was canceled because it took too long to complete”
  • “There was an issue serving your request, please try again in a few minutes”
  • “There was a gateway timeout. You should visit your error log for more information”

Website owners can even customize the page that’s shown if a user encounters a 504 error while using their website, which means you might get a nicely branded page that uses some combination of the codes and content above.

Other times, you might just find yourself staring at a blank screen! Because the 504 error is pretty common, it’s not a bad idea to assume a blank page is due to a server timeout situation and apply the steps we’ll provide later in this guide to correct it.

What The 504 Gateway Timeout Error Means

Technically, 504 Gateway Timeout is a server-side error from a server acting as a gateway or proxy. It means that the server timed out while waiting for a response from the next server that it needed to communicate with, and thus didn’t complete the action it was asked to do.

What does that translate to in less technical terms? (In English, please.)

Here’s how it happened. Let’s dive a bit deeper into the whole process.

When you go to visit a website, the typical process is that the server your browser is using sends a request to the server hosting the website you intend to visit. This request lets the receiving server (often called the “upstream server”) know to start loading the website you want to see. Your server is the gateway in this instance. Your server waits for the upstream server to respond and send it data. If the upstream server doesn’t do so on time, instead of your destination website you’re served a 504 Gateway Timeout error message instead.

Fixing 504 Gateway Timeout: 9 Quick Solutions (2)

Sometimes the error can resolve itself, but other times it may take going into different systems to implement a fix.

Now that you know what you’re looking at, let’s figure out why you’re seeing it.

What Causes The 504 Gateway Timeout?

The reason a 504 error is so common is that server timing issues can occur for a variety of reasons.

Here are many of the most popular underlying troubles:

Server hiccups: Servers go down and slow down all the time for various reasons: increased traffic, maintenance, hardware failure, etc. If any of the servers that you need to work together to load a website are down, you’re likely going to see an error due to timing issues.

Resource limitations: If your website is getting more traffic, even if that traffic is from legitimate sources, it may be more than your current setup is ready to handle.

Other, more general interruptions: There’s a lot more than server uptime that can go wrong when loading websites. Routers can go out, devices can glitch, and so on. Any of these can trip up the server-to-server connection and put you in 504 jail.

Proxy server problems: Proxy servers can add another layer of security, but sometimes they can throw off the steam of communication between the gateway and upstream servers.

Firewall confusion: Firewalls, especially those with extra security measures or custom configurations, might block certain connections by mistake, thinking they’re an attack. This can happen more if you’re using a firewall to restrict certain internet service providers (ISPs) or content delivery networks (CDNs).

DNS issues: Sometimes, domain name system (DNS) servers can’t match the right domain name to the right IP address. This may be caused by recent IP changes, old DNS information being cached, or the DNS configuration being off.

DreamHost Glossary

DNS

The Domain Name System (DNS) protocol keeps records of which domain names correspond to specific IP addresses. DNS enables you to browse the web by typing in regular URLs instead of IP addresses.

Read More

Website code errors: A mistake within your website code may make it so that your server, or upstream servers down the line, can’t accurately talk to each other, leading to a timeout when they can’t resolve the miscommunication.

PHP worker limitations: In WordPress, PHP workers are processes that help serve your website content to visitors. If you don’t have enough of these in place to keep up with traffic, a server may have to ‘get in line’ before its request can be answered, which will likely cause it to time out.

DreamHost Glossary

PHP

PHP (Hypertext Preprocessor) is an open-source scripting language. It’s widely used in web development and can be embedded in HTML. Several popular Content Management Systems (CMS), such as WordPress, are built with PHP.

Read More

Why Fix The 504 Gateway Timeout Error?

OK, now for one very important consideration before we get into the work of fixing timeout errors: why bother fixing the 504 error at all?

There are really two core reasons to care here: user experience and SEO.

Any of the HTTP 500 errors stop a website from loading. That’s probably the worst experience you can create for a visitor to your website — especially for first-time visitors who were referred to your website or landed there from an ad, as it can leave a bad taste in their mouth that keeps them from ever returning. That’s a problem not just for your ego and brand but for your sales and retention.

Then, there’s search engine optimization (SEO) to consider.

DreamHost Glossary

SEO

Search Engine Optimization (SEO) is the practice of improving a site’s ranking in search results. Search results are aggregated based on a number of factors, including a site’s relevance and quality. Optimizing your site for these factors can help boost your rankings.

Read More

If a search engine goes to index (basically, read and categorize your website so it knows what kind of searches to display it for) your website and finds that loading is slow or stopped due to a 504 Gateway Timeout error, it can seriously hurt how it chooses to rank your website in search results.

The further down your website appears on a search engine result page (SERP), the less likely people are to click on it, and if search engine indexers encounter loading errors often enough, they may stop indexing your website at all. The result? Removing you from search results altogether.

In an age when clicks are currency, unresolved and repetitive 504 errors can seriously set you back.

How To Fix The 504 Gateway Timeout Error (9 Possibilities)

Daunted? Don’t be. If your website is reporting a 504 Gateway Timeout error, here’s what you need to know to fix it.

1. Refresh The Site

No, really. It could be that simple!

In the case of connectivity interruptions, device snafus, traffic overload, and maintenance, it’s probably just a matter of bad timing. Give it a minute and refresh your site to see if those issues have been resolved and your site is back to being as accessible as ever.

Here’s how:

  • Google Chrome on Mac: Hit Command + R
  • Google Chrome on Windows: Use Ctrl + R
  • Safari (currently only supported on Mac): Command + R
  • Microsoft Edge on Windows: CTRL+R
  • Microsoft Edge on Mac: Command + Shift + R
Fixing 504 Gateway Timeout: 9 Quick Solutions (3)

2. Switch/Restart Devices And Browsers

Hardware bugs, outdated caches, and other pretty simple glitches can interrupt the server connection and cause a timeout-related error.

Try restarting and also changing up the devices and/or browsers you’re working on to see if your site loads. You may also want to reboot your modem or router. This may fix everything. Or, if you find your site starts working in some places but not in others, it may at least help you narrow down what’s going on.

To restart most modern desktop machines on MacOS, go to the Apple menu (top left) > Restart. For a computer running Windows, it should look something like navigating to Start in the taskbar, selecting the power icon, and then Restart on the next screen.

While you can’t usually bust open and fix any hardware that’s having a problem, you may be able to resolve why some browsers time out while others are perfectly fine. That’s coming up next.

Get Content Delivered Straight to Your Inbox

Subscribe to our blog and receive great content just like this delivered straight to your inbox.

3. Clear Browser Cache

Browsers often store website information locally (to your device) to save loading time. When the records it has stored become out of date, they can lead to connectivity issues.

To clear the browser cache in Google Chrome, click on the three vertical dots in the top-right corner to open the Chrome menu. Visit More Tools > Clear Browsing Data.

Fixing 504 Gateway Timeout: 9 Quick Solutions (4)

Here, you’ll be able to select what you want to clear and over what time frame. Just be sure to hit the Clear data button to complete your mission. Keep in mind this can look different depending on your device and operating system.

Fixing 504 Gateway Timeout: 9 Quick Solutions (5)

For Safari, select Safari in the top left cover, then > Clear History > All History > Clear History button.

To clear the browser cache on Microsoft Edge, it’s as easy as putting “edge://settings/clearbrowserdata” in the address bar and selecting what you want to clear and for what time range.

Keep in mind that these processes can look different depending on your device and which version of each operating system you’re on.

4. Consider DNS Changes And Cache

If you or your hosting provider has changed your website’s DNS server due to adopting a new IP address or a whole new WordPress website host, those changes can take time to go live and for everything to work together flawlessly again. It can take as many as 48 hours for the full propagation to wrap up.

However, if there haven’t been any changes you’re aware of, or it’s been well past the waiting period, it could be another caching issue, this time at the DNS level.

Clearing your DNS cache will prompt the device you’re using to request updated information from the DNS server on websites, so it will no longer attempt to connect using out-of-date DNS info.

Here’s how:

Windows:

  • Press Win + R and type in ipconfig /flushdns
  • Hit Ctrl + Shift + Enter to run the command prompt
  • You should see a success message when complete

Mac:

  • Make sure you’re running the newest operating system
  • Open the Terminal and type in sudo killall -HUP mDNSResponder (The operating system you’re using may impact the success of this command, so if this doesn’t seem to work you may need to search “flush DNS cache mac OS [your version here]”)
  • Hit Enter
  • Input your admin password if prompted, then Enter again to run the command.
    Note: You likely won’t see a success message after this. The command should just run.

Google Chrome (Yep, it has its own DNS cache!)

  • Enter “chrome://net-internals/#dns” into your Chrome address bar and hit Enter
  • Click the Clear host cache button on the next screen

5. Disable The CDN

If you haven’t solved it yet, the issue might be your content delivery network. And you can find out if it’s the culprit by turning it off temporarily and seeing if that helps.

If you’re using a CDN WordPress plugin and you can access your plugins, simply deactivate it then test if your site will load. (Access this via WordPress Dashboard > Plugins.)

However, if you can’t get to your WordPress admin due to the 504 timeout error, you can access your site via your host’s file manager or secure file transfer protocol (SFTP). Here’s how it’s done for DreamHost users.

Once you’re in your site’s directory, navigate to your website’s name then wp-content > plugins > your CDN plugin’s file. Rename that file (something like file name_OFF), save your changes, and refresh your website to see if that has worked.

When this experiment is over, be sure to restore the original name of the folder and save it again so the plugin can function. You may also want to visit the plugins section of your WordPress admin to make sure it’s on and running.

While this won’t fix the issue, it will tell you if your CDN is acting up, from which point you can choose to move to a different provider if it makes sense.

6. Check WordPress Plugins

Because WordPress plugins are independent little packets of code that integrate with your WordPress instance, if they go buggy they can interrupt the server connection and throw a 504.

To find out if this is what’s going on, the process is very similar to what we did above.

First, if you can get to your WordPress admin, go to the Plugins page and deactivate everything. Then, reactivate each one at a time and refresh your site to see if it loads seamlessly. When you catch the culprit, you can deactivate it and look for a newer version or alternative.

Fixing 504 Gateway Timeout: 9 Quick Solutions (6)

If you can’t access the dashboard, you’ll have to open it up via your host file manager or an SFTP platform.

In the directory, navigate to your website name > wp-content > plugins. Now rename that whole file (like plugins_OFF) save, and reload. If it works, you know the rub is in your plugins somewhere. Now you should be able to log into your WP admin, navigate to your plugins, and turn them back on one by one to see which trips up your website load time.

7. Turn Off Your Firewall

Fixing 504 Gateway Timeout: 9 Quick Solutions (7)

To temporarily turn off your firewall to see if its settings are what’s causing the 504 error, follow these steps:

Windows:

  • Start menu > Settings > Privacy & security > Windows Security > Firewall & network protection
  • Choose your network profile
  • Find Microsoft Defender Firewall and switch off

Mac:

  • Apple menu > System Preferences > Security & Privacy > Firewall (at the top of the box)
  • Select the button to turn the firewall on
  • You may have to unlock this page using your password to make any changes

(Note: We recommend turning your firewall back on! If it’s causing gateway errors, once it’s back on you can take some time digging into its configurations to improve performance.)

8. Change Web Server Settings

For the more technically advanced, changing the settings on Apache and NGINX may help you reduce or even eliminate 504 errors.

Here’s how:

Apache

  • Find your Apache configuration file (httpd.conf or apache2.conf)
  • Open it in a text editor
  • Modify Timeout by increasing the default to 60 seconds. So if you want it to be 500 seconds, for example, use Timeout 500
  • Save and exit the editor
  • Now, open and edit the php.ini file by increasing max_execution_time from the default 30 seconds to something like 400 seconds using max_execution_time = 400
  • Save and restart Apache to put your timing increases into effect using sudo service apache2 restart

NGINX

  • Locate the NGINX configuration file (often /etc/nginx/nginx.conf)
  • For NGINX + FastCGI Process Manager or when using NGINX as a reverse proxy for Apache, here are all the places where you’re going to increase the default values (we’ll use 500 and 400 seconds again):
    • proxy_connect_timeout 500;
    • proxy_send_timeout 500;
    • proxy_read_timeout 500;
    • send_timeout 500;
    • fastcgi_read_timeout 400;
  • Reload the NGINX server: sudo service nginx reload
  • Edit the PHP-FPM pool config file (/etc/php/[version]/fpm/pool.d/www.conf — put your own version in place of [version])
  • Set: request_terminate_timeout = 400
  • In the php.ini file, set: max_execution_time = 400
  • Reload PHP-FPM and NGINX using sudo service php[version]-fpm reload && sudo service nginx reload

Hopefully, that should be the end of those sensitive timeout server settings!

9. Turn To Your Host For Support

If you’re throwing your hands up in the air and don’t know what else to do anymore, you should always be able to contact your WordPress website host for quick and reliable support.

Aside from troubleshooting and solving problems alongside you, they can also quickly do a few things that tend to wipe out 504 errors, such as increase PHP workers, or upgrade you to a server with more or better resources to handle issues related to traffic.

What’s that we hear? If you’re not working with a hosting company that’s happy to do anything they can to make sure your website is performing well for both searchers and search engines, it’s time to shop around for a new one.

At DreamHost, we’re not just into helping website owners, managers, and builders with common errors — we’re fanatical about the WordPress platform as a whole!

That’s why we offer DreamPress, a package we specifically built for clients who want a hassle-free yet up-to-date and high-performing WordPress website.

And, for a totally white-glove experience, our pro services department can take website development and management off your hands.

Whether you want to get in the weeds with us or just rake in the benefits of a successful WordPress website without getting your hands dirty, DreamHost can create the perfect hosting and support plan for you.

Schedule a free consultation with our pro services team and begin crafting your website’s future today!

Get Content Delivered Straight to Your Inbox

Subscribe to our blog and receive great content just like this delivered straight to your inbox.

Fixing 504 Gateway Timeout: 9 Quick Solutions (2024)

FAQs

How to fix 504 gateway timeout issue? ›

How to Fix 504 Gateway Timeout Error
  1. Refresh the Page. Refreshing the web page is often the first and simplest step in resolving a 504 Gateway Timeout error. ...
  2. Try a Different Browser. ...
  3. Check the Proxy Server Settings. ...
  4. Disable Your Firewall. ...
  5. Flush DNS. ...
  6. Check Your Website's Error Log. ...
  7. Check Your Website's Plugins. ...
  8. Disable the CDN.
Apr 1, 2024

What is 504 gateway timeout limit? ›

If the router does not respond to the client within 50 seconds, then the client will timeout and close the connection with the router. The client will get the response code of 504 . This will cause the NGINX to set a status code of 499 indicating the client closed the connection.

What is HTTP code timeout 504? ›

An HTTP 504 status code (Gateway Timeout) indicates that when CloudFront forwarded a request to the origin (because the requested object wasn't in the edge cache), one of the following happened: The origin returned an HTTP 504 status code to CloudFront. The origin didn't respond before the request expired.

How to avoid 504 gateway timeout in Java? ›

How to Fix the 504 Gateway Timeout Error
  1. Refresh the Page. You can resolve the 504 issue by reloading the page. ...
  2. Check Other Websites. ...
  3. Clear Browser Cache. ...
  4. Restart Your Computer and Network Devices. ...
  5. Flush DNS. ...
  6. Check Plugins and Themes. ...
  7. Disable Your Firewall. ...
  8. Check Error Log.
Mar 13, 2024

What is the difference between request timeout and gateway timeout? ›

The 504 Gateway Timeout status code indicates that the server acting as a gateway or proxy could not receive a response from an upstream server within a specified time. On the other hand, the 408 Request Timeout status code indicates that the client did not send a complete request to the server within a specified time.

What is the error code for timeout? ›

What Does the HTTP 408 Error Code Mean. HTTP 408 status code is returned when a server timeout occurs due to a slow client request. It means the server terminated the connection, resulting in the client receiving the 408 Request Timeout message.

What is a 504 gateway timeout 10 seconds? ›

504 Gateway Timeout means that the ALB couldn't reach the backend, this is also quoted here: "The load balancer failed to establish a connection to the target before the connection timeout expired (10 seconds)." Raising the timeout (which is an idle connection timeout) has no effect.

How to fix 504 gateway timeout nginx? ›

504 Gateway Timeout: What it is and How to Fix it
  1. Refresh the Page.
  2. Check Proxy Settings.
  3. Restart Router.
  4. Contact Website Admin.
  5. Check Resource Usage.
  6. Change PHP Execution Time.
  7. Configure DNS Settings.
  8. Check the Error Log.
Jun 28, 2023

What is the difference between 502 and 504 gateway timeout? ›

A 502 bad gateway means that the server acting as the gateway received an invalid response from the main server. A 504 gateway timeout means that the server acting as the gateway didn't receive a response at all from the main server.

Is 504 a server error? ›

What is a 504 Gateway Timeout Error? A 504 Gateway Timeout Error means your web server didn't receive a timely response from another server upstream when it attempted to load one of your web pages. Put simply, your web servers aren't communicating with each other fast enough.

What is error 504 gateway timeout in load balancer? ›

HTTP 504: Gateway timeout

The load balancer established a connection to the target but the target did not respond before the idle timeout period elapsed. The network ACL for the subnet did not allow traffic from the targets to the load balancer nodes on the ephemeral ports (1024-65535).

How to fix 504 gateway timeout error in Azure? ›

How to fix the issue. Since we are concentrating on an issue with the application code, we can address the time-out issue by increasing the AAG request time-out period gradually until we can use the application and perform the request successfully. By default, the AAG request time-out period is 20 seconds.

What is a bad gateway error? ›

A 502 bad gateway error is an HTTP status code that indicates a communication error between two web servers. You can receive this error when visiting a website that gets an invalid response from its host server or experiences other issues, such as server overloads, network problems, and configuration issues.

How to fix 502 bad gateway? ›

How Do You Fix The 502 Bad Gateway Error? (9 Possible Solutions)
  1. Refresh The Webpage And Try A Different Browser. ...
  2. Test Using Another Device. ...
  3. Clear Your Browser's Cache. ...
  4. Flush The DNS Cache. ...
  5. Check Your Site's Error Log. ...
  6. Deactivate Your Plugins And Themes. ...
  7. Disable Your CDN Or Firewall. ...
  8. Restart PHP And Increase Your PHP Limits.
Nov 8, 2023

How to handle 504 gateway timeout in spring boot? ›

How to Fix the 504 Gateway Timeout Error
  1. Step 1: Retry the web page by selecting the refresh/reload button, pressing F5, or trying the URL from the address bar again.
  2. Step 2: Restart all of your network devices. ...
  3. Step 3: Check the proxy server settings in your browser or application and make sure they're correct.

What causes a 504 gateway timeout error? ›

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.

Why do I keep getting bad gateway ticketmaster? ›

What Causes the 502 Bad Gateway Error? The most likely causes of the 502 Bad Gateway are: Server overload: the server ran out of resources and crashed, triggering an HTTP error 502. The possible reasons for this could be an unexpected spike in traffic or low memory.

References

Top Articles
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 5962

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.