Urgent help needed - Weird Problem with Cron Job and cloudflare set up

Hi,

I am running into this very weird issue with the Cron job.

We can execute the job manually by entering the webhook URL in the browser.

When scheduling it with the Cron Manager or putting it into cron-job.org, nothing happens. And the cron-job.org reported that the execution failed.

Here is response header cron-job.org saved for us:
Date: Sat, 01 Jun 2019 02:17:28 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=xxxxxxxxxxxxxxxxxxxxx expires=Sun, 31-May-20 02:17:28 GMT; path=/; domain=.mydomain.com HttpOnly Cache-Control: max-age=15 Expires: Sat, 01 Jun 2019 02:17:43 GMT X-Frame-Options: SAMEORIGIN Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ctServer: cloudflare CF-RAY: xxxxxxxxxx-FRA

We have tried updating the .htaccess. Nothing helped.

Please advise.

Jing

The response header isn’t showing much. But it matches a successful hit. A response code would have been nice, like a 200 or 403, etc.

Can you provide more information, like a sanitized version of the cron command?

sDayman,

It is 403 Forbidden.

This is the screenshot:

Jing

The Webhook is: https://discovery.strokefocus.net/lssg/mailster/a1177c1c6c8615f94c294f343f15d91f

The cron command we set up in the cron manager is: */2 * * * * curl --request GET ‘https://discovery.strokefocus.net/lssg/mailster/a1177c1c6c8615f94c294f343f15d91f

Below is the response code:

Access denied | discovery.strokefocus.net used Cloudflare to restrict access body{margin:0;padding:0}
Please enable cookies.

Error 1006 Ray ID: 4dff30ce0ce8d6e5 • 2019-06-01 06:39:28 UTC

Access denied

  <section></section><!-- spacer -->

  <div class="cf-section cf-wrapper">
    <div class="cf-columns two">
      <div class="cf-column">
        <h2 data-translate="what_happened">What happened?</h2>
        <p>The owner of this website (discovery.strokefocus.net) has banned your IP address (195.201.26.157).</p>
      </div>

      
    </div>
  </div><!-- /.section -->

  <div class="cf-error-footer cf-wrapper">

Cloudflare Ray ID: 4dff30ce0ce8d6e5 Your IP: 195.201.26.157 Performance & security by Cloudflare

</div><!-- /#cf-error-details -->
Close

Another we got is this:

Failed 302 Found

Response Header

Date: Sat, 01 Jun 2019 07:21:46 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=de4754a44b389302ffe60dac0fcbf8d7c1559373705; expires=Sun, 31-May-20 07:21:45 GMT; path=/; domain=.strokefocus.net; HttpOnly Expires: Wed, 11 Jan 1984 05:00:00 GMT Cache-Control: no-cache, must-revalidate, max-age=0 X-Redirect-By: WordPress Location: https://discovery.strokefocus.net/up/mailster/a1177c1c6c8615f94c294f343f15d91f)?mailster_error=1 X-Endurance-Cache-Level: 2 X-Cache: MISS Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ctServer: cloudflare CF-RAY: 4dff6ebc38889ac8-FRA

I’m curious about this as well. I sometimes get a 403 when I try to curl some Cloudflare users’ sites. But it would work fine in the browser. I suspect it’s something on the server that’s blocking those requests. I suggest you look through your server logs for these requests to see if the 403 is coming from your server. I just tried your curl command and it worked.

The 302 response in your last post is a redirect from Wordpress. This usually happens if the scheme or hostname doesn’t quite match the site’s URL, like it’s http instead of https.

p.s. I don’t know if the forum reformatted your curl command, but it’s using smart quotes. That may cause a problem during execution if your command really uses the smart quote character.

sdayman,

Yes. We finally found the issue. And fixed it. But we now have a new issue.

The cron job as scheduled will not trigger although we put it in cron-job or the cron management panel. But as soon as the admin logs into the admin panel, the cron will start to work.

When the cron is triggered, it runs fine.

We never had this issue before.

Do you have any advice for that?

Jing

A little unrelated to CF, but it sounds like the server isn’t running the cron daemon/service. If it says enabled in your control panel but it isn’t triggering, you should look into it via the command line or contact your host.

This sounds like they’re using cron-job.org to run their cronjobs. So they would need to contact that service’s helpdesk.

1 Like

Judge, the server has its own cron tab. If I set it up on the Cron manager tab, it is same result. So does it mean the server company should check if the Cron Daemon/Service is running?

Jing

sdayman,

We moved the cron job to cron-job.org because it saves the responses.

The server company has its own cron manager tab. If we move the cron job there, the results are the same.

Jing

A cron job not running (locally) is a problem with the server.

This sounds like either the cron service or the cron task (what’s being ran) is coded poorly to where it just hooks onto the next admin page action to run.

Judge,

We have found the issue.

We turned off the Varnish and the Cron is working. It seems the Varnish was causing the problem.

Jing

3 Likes

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