What Does 504 Gateway Timeout Mean: Tips to Solve the Problem

How can you fix a 504 error code? Here are some recommendations for how to get rid of that white screen and the annoying code 504.

is*hosting team 20 Apr 2023 5 min reading
What Does 504 Gateway Timeout Mean: Tips to Solve the Problem

It’s annoying to see an error when you visit a website. The gateway timeout error (504) is as common as the 500 and 502 errors. Sooner or later, every user or site owner will come across it, so don't worry, you're not alone.

What is the 504 gateway timeout?

Any of the 5xx HTTP status codes indicate that something is wrong with the server. The server is aware of the problem and cannot process the client's request.

A 504 Gateway Timeout Error is displayed in the browser window when the server does not receive a timely response from the other server responsible for showing the requested website. This error can also occur when two servers are involved in processing the request. If the first (primary) server is delayed, it will wait for a response from the second (upstream) server. Then the response time expires and the user sees a 504 error.

Different browsers, operating systems, and server types may display the 504 Gateway Timeout error differently. For example, they may display only the code (504) or only the description (Gateway Timeout).

Causes of 504 Gateway Timeout Error

Causes of 504 Gateway Timeout Error

  • Server overload.

This is the most common cause of a 504 error - when a large number of requests are sent to the server and it cannot process them in time. This situation can be caused by high traffic, incorrect server configuration or a DDoS attack.

  • Network congestion.

An excessive number of devices trying to connect to the network, overloaded switches and misconfigured routers can cause delayed server response.

  • DNS problems.

Sometimes an incorrect DNS entry prevents a user from accessing a website. When a user makes an HTTP request, the Domain Name System simply can't find the correct IP address. The problem may be with the CNAME as well as the A record.

  • Incorrect server configuration.

In this case the problem may be hidden in the code or other settings. The server may need to be reconfigured to handle requests that are currently returning a 504 error to users.

  • Invalid URL.

Yes, a small mistake in the requested page address and you will get a Gateway Timeout Error.

  • Browser and cache problems.

If browser cache files are corrupted or not updated, this can cause an error.

  • Incorrect operation of plugins and themes in the CMS.

For example, in the WordPress CMS, incompatibility or incorrect operation of some plugins and themes leads to all sorts of errors. Therefore, site owners should always monitor the settings of the CMS.

  • Problems with the firewall.

The server firewall, which is designed to prevent malware and hacker intrusions, can prevent ordinary users from accessing the site due to improper configuration.

  • A corrupted database.

A problem with the database or even a specific table can cause a 504 error. Such messages appear when you try to log in to the site control panel.

Impact of 504 errors on SEO

Impact of 504 errors on SEO

504 Gateway Timeout errors have a negative impact on a website's SEO. These errors prevent the web page from loading, which negatively affects the user experience. In most cases, 504 errors are caused by problems with the website itself or problems on the server side, but the result is the same - the client cannot access the requested page.

The most common negative impact of a 504 error is a drop in rankings when search engines are unable to index the pages on the site. So, in addition to frustrating users, frequent 504 errors can affect the effectiveness of a site's search engine optimization (SEO) efforts.

How to fix the 504 gateway timeout error?

How to fix the 504 gateway timeout error?

If you are still unable to determine the exact cause of the 504 error, you should check everything that could be causing it. By following these guidelines, you will be able to eliminate the Gateway Timeout error message from your site:

  • Reload the page and check the URL again.

If the problem was with the page address, or if the problem on the server was temporary, you should be able to access the site after refreshing the page.

Check the website at This service will tell you if the site is down for everyone or if the problem is on your end by checking the HTTP status code from the server.

  • Try another browser.

If the problem is in the browser cache or browser settings, the 504 error should disappear when using a different browser.

  • Check that the site is available on different devices.

Sometimes websites are not compatible with mobile devices, so make sure the site opens on other devices. If the 504 error has disappeared, then you, as the site owner, should reconsider adapting your online resource for different devices.

  • Disable the proxy server.

This rarely happens, but it's worth checking to see if the site works with the proxy server turned off. In Windows, go to the Settings page and then to Network & Internet. There you will find a section with proxy settings. In MacOS, go to System Preferences under Network. Select a Network Service and click Advanced to find the proxy settings.

  • Check the DNS records.

A record is responsible for matching your domain name to your IP address, so make sure you've entered it correctly in the Domain Name System. If you're using canonical names, check the CNAME records.

  • Temporarily disable CDNs.

Sometimes third party CDNs cause a gateway timeout error. Try temporarily disabling the CDN and see if the site works.

  • Keep your site free from spam, bots and DDoS attacks.

An excessive number of requests, whether caused by you or malicious attackers, overloads the server and prevents customers from accessing the site. Take steps to protect your site from spam traffic. For example, many hosting providers offer DDoS protection as an additional service.

  • Check your CMS plugins and themes.

Not all plugins and themes in WordPress work properly. Go to the plugin settings in the control panel and disable them. Then activate the plugins one by one and you will find the problematic one. An alternative is to access the plugins via an FTP client.

We also recommend updating the PHP version if it is out of date, and checking for updates to the CMS itself.

  • Check the logs.

If you still cannot find the cause of the problem, check the logs. The latest entries will help you find the root of the problem and fix it more quickly.

To check the server logs, you need to log into the server using any utility (e.g. ssh) and go to the folder where the logs are stored. These are usually in the /var/log or /var/log/httpd folder.

To view the log file, use the commands cat (to display the entire contents) or tail (e.g. to display only the last 10 lines).

cat /var/log/error.log or tail -n 10 /var/log/error.log

  • Change Nginx parameters.

If you are using Nginx+FastCGI (php-fpm) for website and server, it can also act as a proxy for Apache, you can get rid of 504 errors with additional settings.

In /etc/php5/fpm/pool.d/www.conf set the directive

request_terminate_timeout = 300

Create or change the max_execution_time directive in /etc/php.ini to the value

max_execution_time = 300

Then make changes to nginx.conf by adding the following to the nginx virtual host configuration file

location ~ .php $ {

... fastcgi_read_timeout 300;



Then simply restart Nginx and the PHP FPM:

service nginx reload

service php5-fpm reload

If you are using Nginx as a proxy for Apache, add the following to your nginx.conf file

proxy_connect_timeout 600;

proxy_send_timeout 600;

proxy_read_timeout 600;

send_timeout 600;

Then restart Nginx:

service nginx reload

  • Contact your hosting provider.

Your hosting provider's technical support team will be able to tell you what the problem is and will contact you as soon as possible. Describe the steps you have already taken - this will speed up the process.

Other 5xx errors and their causes

Other 5xx errors and their causes

You may also face other errors of the 5xx type while surfing the Internet:

  • 500 Internal Server Error. The server cannot process the request due to a problem, and the exact cause is unknown.
  • 501 Not implemented. This error reports insufficient functionality to process the request.
  • 502 Bad Gateway. This usually means that the server, which acts as a gateway or proxy server, cannot access the desired resource.
  • 503 Service Unavailable. 503 most often indicates that the server is temporarily unavailable due to overload or technical servicing.
  • 504 Gateway timeout. The server hasn't received a response from the upstream server, to which it has addressed, in the designated period of time.
  • 505 HTTP version not supported. The server doesn’t support the HTTP version that is specified in the user's request.
  • 507 Insufficient storage. Here everything is elementary - the server cannot store the representation needed to successfully complete the request.
  • 510 Not extended. The client's request contains an extension that is not supported by the server. As a result - inability to process the request.
24/7 Support

Rely on us. is*hosting technical support is available 24/7 and does not ignore customers.

Read More