18 March, 2023
What is a 504 Gateway Time-out error? Causes and fixes

Mistake 504 gateway timeout is one of the most common errors when visiting a website, and it stops users from reaching the page they want. So what exactly is a 504 error? What causes it, and what are the most effective fixes? In the article below, MONA Media will answer all of these questions.
What is a 504 Gateway Time-out error?
Gateway Timeout error is an error that a server (server) returns when it can't complete a request, caused by one of the HTTP status codes. This error appears less often than the 502 bad gateway error or 500 internal server errorerror. Still, anyone who browses the internet has probably run into a 504 Gateway Time-out at least once.
A server-side error is recognized when the HTTP status code starts with "5". A 504 Gateway Timeout appears when servers lose contact while communicating with each other and the request isn't completed. In other words, when a server gets no response from proxy or from another gateway server, it can't complete the request within the time limit.
This error shows up in the browser window in many forms, such as:
- 504 Gateway Time-out Nginx
- Gateway Time out Error
- HTTP Error 504 – Gateway Time-out
- 504 Gateway Time-out
- 504 Error
- Gateway Timeout (504)
In addition, in Windows programs that access the internet on their own, the 504 error usually appears in a small dialog or window with the HTTP_STATUS_GATEWAY_TIMEOUT error and/or the message "The request was timed out waiting for a gateway”.
There is also a less common 504 error: "Gateway Time-out: The proxy server did not receive a timely response from the upstream server“.
What causes a 504 Gateway Time-out error
The 10+ years working with many clients, MONA has handled many 504 errors on websites and answered questions about what causes them. From this work we've put together the common causes of a 504 Gateway Time-out below:
- The server can't handle many high-load requests at the same time, which overloads it and causes a 504 Gateway Time-out.
- Incorrect proxy or gateway configurationcan also lead to a 504 error.
- An unstable internet connection between the server and the proxy or gatewaycan also cause a 504 error.
- A software or hardware fault on the proxy server and gateway can also produce a 504 error.
- In addition, a maximum timeout on the proxy server or gateway that is set too short is another common cause of the 504 error.
The most effective ways to fix a 504 Gateway Time-out error
Reload the page or refresh the website
The reason may be that the server received more requests than usual and couldn't keep up. The first fix for a 504 Gateway Time-out is to wait a few minutes and reload the page (refresh website). In the meantime, use a website checker to see whether the site is down. If the site is still working normally, the problem is on your local machine, not the server.
Try a different browser
If the 504 Gateway Time-out still appears while the website is up and active, try a different web browser. You can also open Incognito Mode or try to clear the cache to deal with any error tied to the browser you're using.
Clear the DNS cache to fix a 504 Gateway Time-out
Based on our experience researching and fixing website problems for clients, MONA has found that a 504 Gateway Time-out sometimes comes from a DNS cache that is DNS Cache wrong or out of date. If that's the cause, the fix is simple: just flush the DNS. Note, though, that the way to clear the DNS cache differs by operating system. So, temporarily switch your DNS server to Google Public DNS to resolve the HTTP status code error if DNS is the cause.
Check the page on another device
If you're on a mobile phone using 4G, try opening the website on a different device and a different network. If it loads normally, the problem is with the device you were using, not the server.
Check the error log
An update or a recent website change can also cause a 504 error. This is easy to fix: add the 3 lines below to the file wp-config.php:
-
Define( ‘WP_DEBUG’, true );
-
Define( ‘WP_DEBUG_LOG’, true );
-
Define( ‘WP_DEBUG_DISPLAY’, false );
–> Then save the changes to the file wp-contents/debug.log
Check your CDN
If you use CDN to speed up content delivery, check it, because the 504 Gateway Time-out may come from there. It may be because CloudFlare is acting as a CDN and reducing DDoS attacks. If the error is caused by CloudFlare, contact the provider for support. If you disable CloudFlare, wait a few hours for DNS to propagate.
Check your plugins
The 504 Gateway Timeout may also be caused by outdated or incompatible plugins. In that case, MONA suggests disabling the plugins to see whether the error is plugin-related. It's easy:
- First, to disable WordPress plugins, go to the wp-content folder, then rename the Plugin folder.
- Next, find the exact plugin causing the error by renaming it back to the name you used before.
- Finally, carry out deactivation in order for each plugin.
To learn more about WordPress plugins, take a look at a few popular ones below:
- What is Jetpack? The basics of the Jetpack WordPress plugin
- What is Yoast SEO? Setup and usage guide
Adjust the server configuration
If you're using VPS Hosting, adjust the server and upgrade some resources.
For Apache servers
- Open the file http.conf => then increase the default Timeout value to
- Open the file php.ini => to raise the limit max_execution _time
- Save the changes
- Starter Apache
- Check whether the 504 error is gone
For Nginx servers
- File /etc/nginx/conf.d/timeout.conf => to raise the limits of these values:
- Proxy_connect_timeout 600
- Proxy_send_timeout 600
- Proxy_read_timeout 600
- Send_timeout 600
- In the file php.ini => raise the limit max_execution_time
- Save and restart Nginx
- Try opening the website again
Restart and reconnect your internet devices
Sometimes a 504 error comes from an unstable internet connection that makes the website fail to load. Try restarting your device first. If that doesn't help, turn off and restart your wifi modem, router and other network devices to restore a stable connection.
Fix a 504 Gateway Time-out on your own website
Check whether your server can correctly resolve all the application domains that need access. If organic is too large, your server may also show a 504 error, although a 503 may be more accurate.
Over WordPress, the message "504: Gateway Time-out" may appear because the database is corrupted. In this case, you need to install WP-DBManager and then try the "Repair DB" feature, followed by "Optimize OB" to see if it helps. Make sure the file .htaccess has no problems, especially if you've just reinstalled WordPress.
Contact your hosting provider
If you've tried everything above but the 504 Gateway Time-out error is still there, contact the provider of your Web Hosting. Describe in detail what you've already tried and give them the related information so their technicians can help you faster and more effectively.
Errors similar to 504 Gateway Time-out
Because all of these happen on the server side, some error messages look alike, such as "504 Gateway Time-out". A few others are 500 Internal Server errors, 504 Service Unavailable, 502 Bad Gateway errors and so on.
There are also HTTP status codes that come from the client side rather than the server, for example the commonly seen error 404 Not Found and error 401 Unauthorized Error.
That is the detailed answer to the question "What is a 504 Gateway Timeout error?" and a roundup of the quickest, most effective ways to fix the 504 Gateway Time-out error . We hope the tips from MONA Media are useful to you. Good luck fixing your 504 error!
Related articles
Professional website
design services
Own a website with a beautiful, 100% exclusive design and a lifetime warranty, with the ability
to expand features flexibly as your business grows, starting today!































Free AI courses
AI tools at work
VI
EN
