524 Timeout Error

Hi, I am having an issue with a payment module in Prestashop, with Cloudflare active the payment process does not fully complete, it hangs part way through, see attached image:

When Cloudflare is diabled the process completes in a few seconds, it loads a new page so I can’t see the exact time but I’d say definetly less than 3 seconds and nowhere near the 100sec limit.

I have also checked the CPU usage and memory usage as per the community tip and that seems fine as well:

When I first installed and tested this module it all worked fine, the problem first developed a few weeks ago.

The shop is in test mode and it is a clean install of the latest version of Prestashop and the payment module so feel free to try it yourself:

To pay you can use the test card number 4242 4242 4242 4242 any expiry date in the future and any 3 digit CVV and 5 digit postcode.

My datacenter is Manchester, I know that the same occurs via the datacenter in Paris as the Prestashop module developer also tested it.

Any help greatly appreciated.

Thanks,
Colin

I presume this is not reproducible but happens only intermittently, right?

Considering you can generally access the URL I’d rather rule out a block of that particular datacentre on your end and would rather assume it was an intermittent issue on your server and it took for some reason longer than 100 seconds, which then fired that error.

You should have that request in your server log and checking your logs might shed some more light on why it took longer in this case and that could allow you to fix it.

Hi Sandro, thanks for taking the time to reply.

Currently the problem is reproducible in so much as it happens every time you go through the payment process when Cloudflare is activated at the moment, this has definitely been the case for over a week, possibly longer. Only when Cloudflare is deactivated does it work properly.

The access logs should be accessible via my FTP in a folder called logs, is that correct? This folder doesn’t have any files in it so I will need to check with my hosting provider and get back to you on that one.

Thanks,
Colin

Right now I can actually confirm the issue. An earlier test did go through.

It appears your validation call is stuck. That really is something you will have to check on your server, for some reason it won’t return a response in time. Maybe there is some additional security layer configured which limits requests, possibly even you have too many requests from the same IP address block (as it is the case with Cloudflare) but that’s just a guess.

Your host should be able to provide you with the logs, though the pure server logs won’t necessarily point towards the issue either as they only contain the requests, but it is a start.

Hi Sandro,

So I spoke to my hosting provider and they were not able to provide me with the server access logs as I am on a shared server so they said it was not possible. They said I should reconfigure my account so that my nameservers pointed to Cloudflare and then I would be able to access the logs from Cloudflare, this was not the case before because Cloudflare was set up automatically by my hosting company and they controlled the DNS files. So I have set up a new account with Cloudflare and adjusted the DNS etc, right now though nothing is working and my website just gives a time out failure. I will give it a bit more time for the DNS to update, maybe now that Cloudflare is configured this (the correct) way it will solve the problem? Anyway, we once the site is up again I will test it and let you know.

Thanks,
Colin

That’s incorrect information I am afraid. For starters, your domain already points to Cloudflare. Secondly, Cloudflare does not have that information, respectively does not provide it on free plans. Also, the pure request logs won’t be of much help, as the issue will be either in your code or in some security layer on your webserver.

It would be best if you had your web developer have a look at that as he should be able to analyse and debug the issue.

OK, well now I am stuck in an endless loop because the module developer just says it is a Cloudflare problem. My domain points to Cloudflare now but yesterday it pointed to my host server, I had to change that. Anyway, the website is back up now and the issue persists. It seems that the only way I can resolve it is by deactivating Cloudflare so that is what I will have to go with. Thanks anyway, I appreciate your help.

You can always drop an email to Cloudflare and have support check out the connections in question, though it is rather unlikely that it will be Cloudflare.

That error simply means that Cloudflare did not get a response in time and as the URL itself works on Cloudflare and only that validation bit times out, it would really suggest it could be for aforementioned reason. You’d need to debug that particular bit and check how that request is handled any where it gets stuck and why.

Again, my best guess would be some security layer which possibly fires because of many requests from the same address block, but that’s speculation of course. You do rewrite IP address on a server level, right? Please use the search if you are not familiar with it.

So I read through the info about IP rewrite, in particular the thread about Paypal, I’m not going to pretend that I understand it completely but I don’t think that is the issue, the information goes to Stripe (the payment handler) is processed and is returned as being ok, that bit all works ok because I can see Stripe processing the test payment and I can see Prestashop acknowleding the payment coming back and it logs the payment as complete and adjusts stock levels etc as appropriate. The hang up is after that, the part of the process that should direct the customer to the Order Confirmation page.

So as you say it may be something to do with the number of requests, but then would the number of requests not be the same with and without Cloudflare?

The code in this bit is a bit above my skill level so it is going to take some time for me to work it out, but I would like to understand the problem, I will try and replicate it on another server and keep testing it there, but for now I’ll need to get the shop back up and running.

If I make any progress I’ll report back.

Thanks again,
Colin

Yes, but in the case of Cloudflare all requests will come from the same set of network ranges and that might fire a potential security layer on your end. That’s what you will have to debug.

Rewriting the IP address is important as it will be that what such a security layer might take into account but all of that really depends on your setup. I am afraid there really won’t be anything else than trying to check why your server takes longer (or times out completely) in this case.

Well I went and set everything up on a different server and tested it and it worked… So I went back and tested it again on my site and now it works there as well. So whatever the problem was it seems to have fixed itself!

If you didn’t make any changes, then your host must have made some changes. Or maybe your server had to handle too much traffic and certain actions took too long on the database.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.