Cron Job Not Running

Hello,
I have a website in php. But suddenly it stopped running the corn job automatically after I attached Cloudflare acount with the website.

  1. The HTTP Browser integrity is disabled.
    2.No Bot fight mood is there.
  2. When I pause the Cloudflare in my site. The site stops working and shows that this site has HSTS attached with it. But it has no HSTS.
  3. I have also attached my servers IP from the firewall filter.
    Can anyone help please?

Hi @maxbroker33,
Welcome to Cloudflare Community. As you have mentioned that the browser is asking for HSTS, then it might be possible that you have either enabled HSTS at your web server level or in Cloudflare Dashboard > SSL section. When HSTS is enabled non-HTTPS requests are not allowed to be executed.

Moreover, when you are setting up the CRON job inside your server, how are you mentioning the path to your PHP file in the CRON setup? If you are doing something like https://example.com/some-path/some-file.php then I must tell you that this is a bad way to setting up CRON. This is because every time the CRON is executed the server will have to make an HTTP request to start processing the job.

Rather it is better to use the absolute path of the PHP file in the CRON job, something like /home/nginx/public/some-folder/some-file.php. In this way, the web server will get the file at the file level without the need to process an HTTP request. This will also result in a faster CRON execution.

Now coming to why you are facing this problem, I think when you are making the automated CRON jobs, Cloudflare Firewall is blocking those automated requests due to security issues. Please check Security > Events within your Cloudflare account where you will get to see if your CRON request is being blocked by Cloudflare and if so, create a firewall rule to allow them.

Hope this helps. :slight_smile:

1 Like

Hello,
I have changed the the corn job settings and the path is now " /home/nginx/public/some-folder/some-file.php " like this and still it is not working. And if I don’t want to change the HSTS settings, will the corn will not run. Although HSTS is not enabled but still showing enabled. Also I have checked the firewall path and no mention of corn job path.

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