You may have encountered the 504 Gateway Timeout Error a few times while trying to visit websites.
It can be frustrating as the 504 Gateway Timeout Error is one of the most common errors faced by users and site owners. Unfortunately, it’s also a mysterious error because it doesn’t specify what the issue is.
If you own a website or a blog, it will be helpful to understand what the 504 Gateway Timeout Error is, find out what is causing it, and ultimately fix it.
This article will help explain all you need to know about the 504 Gateway Timeout Error.
Table Of Contents
- What is the 504 Gateway Timeout Error?
- Variations of the 504 Gateway Timeout Error
- Potential Causes of the 504 Gateway Timeout Error
- How to Fix the 504 Gateway Timeout Error: 5 Ways
- Various Examples of 504 Gateway Timeouts (How the Errors Look/What the Differences Are)
- Why Are You Seeing The 504 Gateway Timeout Error Message?
- Troubleshooting (Health Mode)
- Check Your Site’s Plugins, Theme, and Server Error Logs
What is the 504 Gateway Timeout Error?
In simple terms, the 504 gateway timeout error happens when the website doesn’t receive a timely response from a server. Each time you visit a website, the browser will send a request to the server where the site is hosted. The server processes the requests and responds to the website with the requested resources.
The 504 gateway timeout error is mysterious and can be challenging to fix. It indicates the server was unable to process the request, but it doesn’t tell you why it was unable to do so. It also tells you the server is aware it couldn’t carry out the request but was unable to fix the issue in time.
Variations of the 504 Gateway Timeout Error
Depending on your operating system and browser, the 504 gateway timeout error can appear in various ways.
Some of the common 504 error messages may look like this:
- HTTP 504
- HTTP Error 504
- 504 Gateway Timeout
- The page isn’t working – Domain took too long to respond
Your browser and certain websites can customize how the error message is displayed. Though the message can be worded in different ways, it points to the same server error.
Potential Causes of the 504 Gateway Timeout Error
So, what could cause the 504 gateway timeout error? Since the error refers to the server timing out on a request, it usually points to an issue with the network rather than with the device.
Some of the possible causes could be:
- Server is currently not working or under maintenance
- Server is not functioning properly
- Connection between server and internet was interrupted
- Server may be overloaded with requests
Now that you understand the issue sits with the server and not the client-side, you can eliminate your device or internet connection when trying to fix the 504 gateway timeout error.
How to Fix the 504 Gateway Timeout Error: 5 Ways
It can be a challenge to figure out what is causing the timeout error. Since this is considered a network error in the server and not with your computer, there are many reasons why the error message popped up, which we’ll talk about later in this article. Here are a few things you can do to try fixing the issue.
1. Reloading Your Website
You can try reloading the website you’re trying to visit. If you’re trying to visit the website on your computer, you can click the refresh button or the F5 key to see if it was just a temporary interruption with the connection. Otherwise, you can also try some of these suggestions.
- Turn off your VPN, then refreshing the website
- Try another browser
- Restart your browser
Some 504 gateway timeout errors happen when the server is temporarily overloaded. By clicking refresh or reload, the website will send out a new request to the server. If it was just a temporary overload or connection issue, the website should load in your browser.
2. Restart All Network Devices
A temporary disruption in your network connection can cause the gateway timeout error. You can try restarting all your network devices, including your modem and router to see if it will fix the issue.
It’s as easy as unplugging both your router and modem, then waiting for 30 seconds before plugging it back in. You’ll have to wait another 60 seconds to start everything up and see if the issue persists.
3. Check The Proxy Server Settings
Check the proxy settings in your browser and application, and make sure they’re correct. Incorrect proxy settings can cause 504 errors. Some computers don’t have proxy settings at all.
If you have Windows 10 or Windows 11, you don’t have to set your proxy settings in each browser. You can check and change the settings directly in Windows 10 or Windows 11, and it’ll apply to Google Chrome, Opera, Microsoft Edge, and Firefox.
Here are the steps:
- Open the Start menu and select the gear icon (Settings).
- In Settings, select Network and Internet.
- In the left-hand pane, click Proxy.
- You’ll be able to view all the proxy settings in Windows. Everything should be set to off. If there is something turned on, it means your web traffic is going through a proxy.
The steps are similar if you are using macOS. This will apply to the settings in Safari as well:
- Open System Preferences and select Network.
- On the left tab, make sure to select the active network connection.
- Then click Advanced at the bottom
- Select Proxies.
- You’ll see a list of proxy servers you’ll be able to configure.
You can follow these steps if you’re using Internet Explorer:
Open Internet Explorer, then click Internet Options.
- Click on the Connections tab, then LAN settings to open the LAN settings window.
- If you’re using a proxy server with a URL, check the box for “use automatic configuration script”.
- Then in the Address field, type the URL.
- If you’re using a proxy server with an IP address, check the box for “use a proxy server for your LAN”.
- When you’ve made your selections, click OK to save your changes
In most cases, everything in your proxy settings should be set to off, or to “automatically detect settings”. This allows your computer to automatically select the best proxy settings for you.
4. Change DNS Servers
If you’ve tried connecting to the website on other devices but you’re still getting the same error message, you can consider changing your DNS servers. The Google Public DNS server provides a secure DNS connection. You can change your DNS server to some of the free public DNS servers listed below.
- Google DNS – 22.214.171.124
- Cloudflare – 126.96.36.199
- OpenDNS – 188.8.131.52
It’s possible the DNS server you’re using is causing the issue with the 504 gateway timeout error. We’ve listed the steps you can take to change your DNS server.
Changing DNS server on Windows:
- Open the Start menu and select the gear icon (Settings).
- Once you’re in settings, click Network and Internet.
- Select Change adapter options.
- Right-click your chosen internet connection and select Properties.
- Click Internet Protocol Version 4, then click the Properties button.
- Click the item labeled Use the following DNS server addresses.
- Enter your two chosen addresses.
- Click OK to save your changes.
Changing DNS server on macOS:
- Select Preferences from the Apple Menu.
- Launch the Network app.
- Select your internet connection and click the Advanced button.
- In the Advanced window, select the DNS tab.
- Use the plus-sign on the right to add your chosen DNS addresses.
- Click OK to save your changes.
If you decide to change the DNS server on your router, just remember that this will affect all your connected devices. This also includes smart appliances and home security. Before starting, search “how to change DNS” for the make and model of your router. You’ll need instructions that are specific to your router’s model.
5. Temporarily Disable Your Site’s Content Delivery Network
The content delivery network you’re connecting to can sometimes cause the error message. If the website’s origin server is unreachable, the CDN will try to load the website from its cache. However, some CDNs don’t have this feature enabled as it can be complicated to cache certain assets on websites. An easy way to do this is to temporarily disable your CDN.
The WordPress Popup plugin uses a CDN server to store files like images, and CSS libraries. You can temporarily disable this with the following steps:
- Head to the WordPress admin area of your website.
- Under the Settings tab, select the Popup plugin.
- Activate the “Disable CDN usage” option.
- Save changes.
If you’re using the Onyx CDN, you can follow these steps:
- Login to your Onyx dashboard.
- Select the website you want to disable the CDN for.
- In the left-hand menu, select CDN.
- Select the Disable CDN button.
- Log in to the User Portal.
- Click Sites.
- Select the production environment name.
- Select CDN.
- Uncheck the box on the right to indicate you’re disabling CDN.
- Be sure to save your changes.
Various Examples of 504 Gateway Timeouts (How the Errors Look/What the Differences Are)
There are two main ways the 504 gateway timeout error can show up on your screen. It can be helpful to differentiate between the two to find out where the issue lies.
Certain CDNs, like Cloudflare that provide full proxy services, have additional firewalls between their servers and yours. This may cause you to encounter the error message more frequently.
The error message above usually occurs when the issue is caused by Cloudflare itself. If you see this message, it’s advisable to contact their user support or check their status page.
A custom error message like the one above indicates the issue is with the webserver and not Cloudflare. You can see from the diagram where the issue lies. If you own a website and encounter this message, you can get in touch with your hosting provider for support.
In Windows-based programs, the 504 gateway timeout error might pop up in a small dialog box with a message saying HTTP_STATUS_GATEWAY_TIMEOUT. A Windows update will generate an error code 0x80244023 or display an error message WU_E_PT_HTTP_STATUS_GATEWAY_TIMEOUT.
Why Are You Seeing The 504 Gateway Timeout Error Message?
There are many reasons why you would encounter the 504 bad gateway timeout error message. We’ve listed some of the more common reasons below.
1. Server Issues (Check With Your Host)
One of the reasons why you would encounter the 504 gateway timeout error message is server issues. This is especially common with high-traffic websites like WordPress blogs, e-commerce sites, or online stores.
There are a few steps you can take to troubleshoot the issue and decide if you should contact your host.
- Try accessing the website from other devices, for example, your mobile phone. If you are able to view the website on your mobile phone, but not your computer, it tells you the problem lies with the settings in your computer and not the server. However, if it does not work on all your devices, you should call your hosting provider for assistance.
- Websites like Downdetector will also be able to tell you if the website is currently experiencing technical issues and if other people are having problems connecting to it.
- You can also do a Google search “is abc.com down” or check Twitter to see if other people are experiencing the same issue.
- It’s recommended for you to check your WordPress host’s status page as well.
You should check with your host if they have plans or resources to fix this issue if it happens regularly. However, there can be other reasons for the error message.
2. Firewall Issues
Improper configuration can cause your server’s firewall to have some errors. It could be that a few of the firewall’s rules are preventing the server from establishing a proper connection.
You can check your server’s error logs to see if your firewall is the one causing the issues. To view the raw access and WordPress error logs via FTP, you can follow these steps.
- Connect your site via SFTP.
- You’ll see a folder named “logs” in the root folder.
- Your access and error logs will be in that folder.
3. Slow Server Infrastructure
The server you’re using to host your website may not have enough resources to handle the traffic. This happens when the server is overloaded, causing it to timeout while trying to load the website. You can fix this by upgrading to a server with better and stronger infrastructure.
4. Network Connectivity problems
Issues with the connection between the proxy server and your web server can be the cause of not responding to requests. A load balancer can also cause network connection issues.
5. HTTP Timeouts
HTTP timeouts happen when the connection between the web server and the client is kept open for too long. If you’re using WordPress websites, this can happen with WordPress imports. One easy way to solve this is to just switch to a better internet connection.
6. Needs more PHP Workers
Each website requires different resources. An online business website will require more resources than a blog because it receives more traffic. PHP workers are used to executing your website’s code. If the PHP workers are busy, a queue will build up. If the queue gets too large, the server will forgo old requests for new ones, which causes the 504 gateway timeout error. You can request more PHP workers from your host to avoid this.
7. Spam, Bots, or DDoS Attacks
If your website has been attacked by DDoS or spammed by bots, it can overload the server. You can troubleshoot this by requesting a report from your host provider.
There are three reports you can look at. The first is the top-end customer’s IP addresses which is useful if you notice your website is suddenly generating a lot of traffic. You can use this to distinguish if the traffic is genuine or if your website has been attacked by bots.
The second is the requests and bots report. You can compare the number of people visiting your website versus the number of bots. The third report is the cache analysis report. In this report, you can see what requests are missing in the cache. You should try to cache as many requests as possible to provide the best stability for your website.
8. Corrupted WordPress Database
A corrupted WordPress database or files can cause 504 gateway timeout errors. This can also happen if your website is experiencing security issues or has been hacked. Repairing the database will depend on the problem it’s having. Certain plugins like WP-DBManager can help you diagnose any issues with the database and repair them.
Troubleshooting (Health Mode)
There are a few ways you can tell if there is a problem with your WordPress database. One of them is the “error establishing a database connection” message. You can troubleshoot the database issues by understanding the common problems we’ve listed for databases.
- Connection problems
- Incorrect credentials
- Corrupted database tables or files
- Limited or exceeded PHP Memory
- Your website has been hacked
Check Your Site’s Plugins, Theme, and Server Error Logs
There is a small chance that third-party plugins can cause server timeouts by queuing up one too many uncached requests. This takes up a lot of PHP workers and can cause the 504 gateway timeout error to occur.
You can simply troubleshoot this problem by deactivating all your plugins and checking if your site is working properly.
If it does, you’ll then have to enable each plugin and test the site after each plugin has been enabled. You should also ensure your WordPress core, including the plugins and themes, are updated.
1. Configure Apache or Nginx Settings Properly
Bugs and faulty plugins in the Apache or Nginx can cause the 504 bad gateway timeout error. You’ll need to analyze the error logs to find out if this is the case.
2. 504 Gateway Timeout Error on Nginx + FastCGI (PHP-FHM)
The 504 gateway timeout error is common when using Nginx with PHP-FHM. This usually means the PHP-FHM took a longer time to generate the response. Some of the reasons for this to happen could be:
- The web server was overloaded and it took longer than usual to process requests.
- The database behind the PHP application was slow
- Nginx timeout configuration included small values
A great way to fix this is to increase the PHP maximum_execution_time, and PHP-FHM request termination time.
3. 504 Gateway Timeout Error on Nginx Proxy
To fix the 504 gateway timeout error on Nginx proxy, you can try adding these variations to the nginx.conf file:
- proxy_connect_timeout 600;
- proxy_send_timeout 600;
- proxy_read_timeout 600;
- send_timeout 600;
4. Other HTTP Errors Like 504 Gateway Timeout
There are other HTTP errors similar to the 504 gateway timeout error. Some of these include:
- 500 Internal Server Error
- 502 Bad Gateway Error
- 503 Service Unavailable
Troubleshooting and fixing a 504 gateway timeout can seem difficult and overwhelming. But there are many ways to fix the error message as long as you know what could be causing it. If you suspect it’s the server causing the issue, you can always contact your host provider to help you.
- Troubleshooting and repairing WordPress database issues
Categories: Server Management