Bobcares

‘504 gateway time-out’ in Prestashop – Here’s how to fix it

by | Feb 24, 2019

Everyone expects their websites to work smoothly.

But, this situation may change anytime and your website may show unexpected errors.

One such error is 504 gateway time-out on your Prestashop website.

At Bobcares, we help customers resolve website errors as part of our Dedicated Support Services.

Today, we’ll discuss the top 6 reasons for this error and how we fix them.

504 gateway time-out in Prestashop – What this means?

Website owners usually face this error when installing a new version of Prestashop, updating a new product from backoffice, etc.

Firstly, our Support Experts enable Prestashop debug mode from backoffice. This helps us to know if there is any other underlying error message.

For example, in Prestashop 1.5.3 -1.6, we enable it by adding the below parameter in the file config/defines.inc.php.

define('_PS_MODE_DEV_', true);

 

Similarly, in Prestashop 1.4 – 1.5.3, we enable debug mode by adding the below parameter in the file config/config.inc.php.

@ini_set('display_errors', 'on');

 

And, once we’re done with the troubleshooting, we’ll disable error reporting, because leaving debug mode enabled can give unpredictable results to visitors.

 

504 gateway time-out in Prestashop – Causes & Fixes

Now, let’s see the main reasons for this error and how our Support Engineers fix them.

1) Client side issues

Misconfigurations at the client side can result in “504 gateway time-out error in Prestashop”. It can be due to various reasons like:

  • Improper browser settings or browser cache.
  • Temporary problems with the network devices such as modems, routers, etc.
  • Incorrect proxy settings in the browser or application.
  • Network issues at the ISP end.

 

How we fix?

Our Support Engineers make customers test these things to confirm that there are no problems at the client side.

  • Double check the browser settings and ask them to access their Prestashop application after clearing the browser cache.
  • Try to load from another browser or from incognito window.
  • Restart network devices such as router, modem, etc. and confirm that they have been configured correctly.
  • Review the proxy settings used in the browser or user’s application.
  • Check if there is any problems with their ISP.

 

If everything works fine, then we do the rest of the checks to identify the issues at the server side.

 

2) Proxy timeout values

Proxy errors are not always due to insufficient resources. It’s also possible that the proxy has been configured incorrectly. As a result, the proxy server times out before processing the request. Similarly, complex and long running scripts which takes longer time to complete the execution also results in this error.

For example, we’ve seen instances where website throws 504 gateway time-out error in Prestashop with Nginx configured as the reverse proxy.

 

How we fix?

Our Support Engineers solve this timeout problem by tweaking certain values in the proxy or the web server configuration file. For instance, we adjust the following parameters in the Nginx reverse proxy configuration file nginx.conf to increase the timeout values.

proxy_connect_timeout
proxy_send_timeout
proxy_read_timeout
send_timeout

 

Similarly, for servers with Nginx and FastCGI(PHP-FPM), our Support Experts resolve this problem by adjusting the parameter max_execution_time in php.ini and request_terminate_timeout  in www.conf files. In addition to that, we adjust the following parameters in the Nginx file.


fastcgi_send_timeout
fastcgi_read_timeout

 

Most importantly, we restart the necessary services such as nginx, php-fpm to bring the changes into effect.

[Need to adjust the proxy settings on your server? Our experienced Server Administrators can help you.]

3) DNS issues

Similarly, 504 gateway time-out prestashop errors can sometimes be a result of incorrect DNS settings. It can be at the server side or the at client side. Let’s first check the issues that can happen at server side.

DNS changes are often required after domain migration, hosting provider switch, etc. So, it’s important to wait for the DNS changes to propagate globally. So, when the customer browses the website or perform updates during the propagation period, timeout error may occur.

That’s why, our Support Engineers reduce the TTL values during migration, inorder to reduce the propagation delay period.

Likewise, the DNS caching issues at the client side can also lead to this error. The DNS cache on the user’s system stores records of all the recent visits. And, if the DNS cache contain old records, it’ll throw errors.

 

How we fix?

Here, our Support Experts check if the DNS propagation period is complete using the dig command.

dig +trace domain.com

 

If not, we’ll ask the customer to check after the DNS propagation period. If there are any DNS resolution errors, we’ll fix them immediately.

Similarly, if we identify that the issue is on the client side, we’ll help the customers to clear their local DNS cache. For example, we use the below command to clear the DNS cache in Windows.

ipconfig /flushdns

 

4) Server issues

The next step is to check whether the problem lies at the server side. We’ve seen instance where the server becomes unresponsive due to heavy load. It can be due to ongoing DDOS attack, heavy website traffic, a compromised server, application bugs causing resource outages, etc.

Sometimes, the web server which handles the incoming requests become too slow due to performance problems or heavy traffic. Similarly, network problems between the proxy server and the web server can cause delays in getting response for HTTP requests.

 

How we fix?

Our Support Experts check the server and identify the abused resource. We then find out which service is abusing the resource. At this point, we identify the user who owns the malicious script or software. Finally, we remove or disable this abusive script.

Similarly, if we find there are no enough resources in the server to process the valid incoming requests, the only solution is to upgrade the resources on the server.

For slow web servers, our Server experts optimize web server and tweak it’s configuration parameters to solve the problem.

[Need help in resolving the frequent load issues on your server? Click here and get one of our Server Experts to fix it for you.]

5) Issues with CDN

Website owners use CDNs(Content Delivery Network) to serve contents faster. However, if it’s not properly configured, it can result in errors. The common errors that we’ve seen are the IP address of the website not set in CDN, firewall blocking CDN, etc.

 

How we fix?

Our Support Experts verify if CDN is creating problems by temporarily disabling the CDN service for the domain. If the website worked well, we’ll review the CDN settings and correct the misconfiguration.

 

6) Website configuration issues

Last but not least, Prestashop configuration issues can also lead to this error.

In other words, corrupted databases, faulty extensions or themes, incorrect configuration can always create problems.

 

How we fix?

Firstly, our Support Experts check the database logs to identify the corrupted databases. Once identified, we repair the database using the mysqlcheck command. Also, we always backup the database before making any changes.

mysqlcheck -r DATABASE

 

Replace DATABASE with original database name.

Similarly, we’ll disable each of the themes/extensions one by one to identify the faulty one. If the website works fine, we upload a fresh copy of the theme/extension. If not, then only the theme developer can fix it.

[Need to recover the corrupted database on your server? We can help you here.]

Conclusion

In short, 504 gateway time-out in Prestashop can occur due to proxy timeout values, DNS issue and more. Today, we’ve discussed the top 6 reasons for this error and how our Dedicated Engineers fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.