Error 524 with cron

I get a 524 error when I run my cron
https: //mywebsite/cron.php/token00000000
180 secondes time limit of my server.
How could I solve this problem
thank you

In short, refactor your code to not rely on an external HTTP call.

Thank for your answer,
But what i must to do please.
I’m realy a debutant with that
refactor? external http call
On the image is only a result of my cron.

I presume that cron is execute on the same machine which you call in your HTTP request, right?

If that is the case you should change your code, respectively the approach, to not require such an HTTP over the network but to execute a local script which performs the same tasks.

I’ve had a similar problem, so I added my hostname to /etc/hosts with the local IP address so it wouldn’t go through Cloudflare.

I’m on a shared hosting and I think that kind of manipulation I can not afford to do so much.
So with Cloudflare I can not use cron?
And solve the error 524?

  1. You did not check out the link from the very first response.
  2. If you get rid of that unnecessary HTTP call you wouldnt have the problem in the first place.

If you are using shared hosting you can use temp-link like http://your-hosting-ip/~your-cpanel-username/cron.php/token00000000 so the request doesn’t go through Cloudflare since its timeout 100 seconds
Or use cli instead of curl: php full-path/cron.php/token00000000

Thank you for your answer my this solution is not applicable on my current hoster!
I can only submit my address for the php file and I can not give it an application code.
I think I have to change hosting. What configuration minium could you advise me?
Is that if I put a white list for this page or this link. Can I solve the problem?

sorry, but what do you mean? What should I do with this server or Cloudflare?
I was told about white list also

currently i am looking for a solution to avoid my concept a 524 error. I do not know the source of this problem. I am currently on hoster sharing.
But if the problem came from the side of my hoster.
I think to take a VPS with 2 cpu 4 ram? enough?
What would be the best configuration?
Thank you

That depends on the amount of traffic your site gets, and how much of that load Cloudflare can absorb.

Your host (or a developer) should have a better idea of what’s causing the timeouts on your site.

He has no idea. That’s why I’m asking the question. Because there is a return error displayed on the link of cron 524. That’s all.
The problem could be solved how is my question

If you’re talking about getting a VPS now, then you’ll be able to route that request directly to your host, as I mentioned earlier. No need to pay for a larger VPS. A small VPS is $5/month.

My question is simple. How to solve ERROR 524 problem.
Whatever the means used. I just want to know how and where this problem can come from which I have never had before with Cloudflare.
Because once, remove the Cloudflare site. The cron works very well. But we absolutely want to use Cloudflare for our project. So do you have a contructive answer to solve the problem.
Should I change server or not?
Should change something or?
Thank you
Best regards

That is a simple question. But we can’t explain why your server takes more than 100 seconds to respond to a request. That’s something you need a good developer for.

All we can tell you is Cloudflare is waiting 100 seconds for a response. It’s up to you to lower that response to something under 100 seconds.

You might be able to make a URL that will have a script, that will use a system() call to create a background task (if your hosts allows it), and exits immediately. The way you background a task is by appending ’ &’ after the command (assuming your host runs Linux).

The background task will use the site address but will do so locally. Inside the background task, you can call the original cron, with something like this:

curl --resolve mywebsite:80: http://mywebsite/cron.php/token00000000

Changing ‘mywebsite’ of course to your domain.

Whether your host allows you to run such background processes, I do not know.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.