Home/Blog/Internet marketing/504 Gateway Time Out: what is a 504 error, and how to fix error code 504

504 Gateway Time Out: what is a 504 error, and how to fix error code 504

The site’s operation may be affected by various errors on the user’s computer or the server. To identify such causes, special codes appear on the screen due to certain faults. Information about what each means will help quickly fix the problem and restore the resource. Every Internet user is in a situation where a 504 Gateway Timeout 


Error or similar appears on the screen in response to typing an address in the search bar, following a link or a search query. Its appearance leads to the fact that visitors immediately leave the resource, not understanding the reasons for 504 errors on the site and, most likely, just going looking for another site. This error can lead to losses due to the outflow of customers. But in any case, do not panic at once. You need to understand why the error occurred and how it can be fixed. If the error code starts with the number 5, it means it occurred on the server-side. For example, it is impossible to execute the request due to communication failure between several servers. It means that one of them could not process your request within the specified period. Because users use different browsers with different operating systems and server configurations, error 504 in the browser may look different. It can be represented in one of the following ways, but no matter what the text looks like, this error will still have the same meaning:


  • 504 Gateway Timeout 
  • 504 Gateway Timeout NGINX 
  • NGINX 504 Gateway Timeout 
  • Gateway Timeout Error 
  • Error 504 
  • HTTP Error 504
  • HTTP Error 504 – Gateway Timeout
  • HTTP 504
  • 504 Error
  • Gateway Timeout (504)
  • 504 Gateway Time-out – The server did not respond in time. 
504 gateway time out

Despite this variety of names, the main reasons why there is a 504 server response code are only three:


  1. The limit of use of available resources is exceeded, namely the limit on the maximum number of running processes that run simultaneously on virtual hosting.
  2. The load on the site has increased. Requests became too frequent, and the web server ran out of time to respond. As a result, a queue is formed, and the connection may be lost after a certain period.
  3. Error code 504 may appear if the script takes too long to process. It happens if it sends a query to other sites or executes a complex query, such as a search query, with many criteria, or when the php.ini file has a hard limit on the PHP parameter max_execution_time.


What to do if a 504 error occurs? Here are the main ways you can try to fix the 504 Gateway Time Out error yourself.


  1. Please refresh the page after waiting a few minutes. It is the first and easiest way to solve any mistake.
  2. Clear your Internet browser cache or go to the site in private browsing.
  3. Use one or more other browsers.
  4. Clear the DNS cache, which may contain obsolete files.
  5. You can try temporarily switching DNS servers to Google Public DNS if you are an advanced user.
  6. Check the operation of the site on different devices as well as on several networks.
  7. Go to the resource using the service downforeveryoneorjustme.com. 
  8. See the error log for hints.
  9. Check the plug-ins and extensions used on your site that may have made it inoperable. A 504 error may occur if they are outdated, incompatible, or with other software. Try temporarily disabling all plug-ins and then enabling them one at a time. It will allow you to understand which one could have caused the error.
  10.  Go to a non-working site through a proxy.
  11. Make sure the CDN is OK if you use it to increase the speed of content. Because of its use, two types of 504 gateway timeout errors can occur: 
    – by Cloudflare; 
    – by the hosting or provider.
  12. Change the server settings and increase the limit of some resources.


If none of the above helps and you cannot fix error 504, you will need to contact your hosting support. Provide as much information as possible about the error and the steps taken to correct it. It will allow you to provide better the help you need and solve the problem with the server’s 504 response code.

Worth a read