Support » Plugin: WP Cloudflare Super Page Cache » Issues with running Cron Jon (External or Server)

  • Resolved Amar

    (@amarudare)


    I have turned of WP Cron and was running it using a Cron Job from the server. Unfortunately, the Cron Job URL was being cached Cloudflare and the requests were being served from CDN rather than hitting the server.
    Setting a bypass URL in the plugin settings did not work presumably because the link is OUTSIDE the WP environment. I did not see any of the WP Super Cache headers in the URL request.

    Is there a solution to this? I can enable WP Cron but it is a hit and miss because most of the website is being delivered from the CDN so Cron will not be activated.

    Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @amarudare,
    CRON Job urls never get cached. Can you share your VRON job URL so that we can check the response header of it?

    Thread Starter Amar

    (@amarudare)

    Unfortunately, I had to deactivate the plugin as I needed CRON functionality but they WERE being cached. I know for sure.

    The first response was slow and the second was a quick connect. I checked the headers for those and the first one was a Cloudflare Cache Miss while the second one was a hit. The first one triggered the Cron while the second did not.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @amarudare,
    Fast or slow response won’t help us to see/diagnose anything. If you can enable the plugin for a while and then share the CRON URL so that we can see the exact response header, that way we can see what’s happening. I am also using server-level cron on my site and none of them are getting bypassed.
    If you have turned on the APO inside cloudflare dashboard, make sure you disable that and test.

    Screenshot: https://i.imgur.com/FOVzvHf.png

    Thread Starter Amar

    (@amarudare)

    I know that fast or slow response won’t help us diagnose but the point I was trying to highlight is that the second response is served from Cloudflare CDN Cache rather than hitting the server.

    First hit: https://imgur.com/a/Wz9yFkH
    Subsequent hits: https://imgur.com/cQRKUSN

    This is only true when WP Super Cache is on and the Cache everything rule in Cloudflare is on.

    Thanks.

    Thread Starter Amar

    (@amarudare)

    I have force purged everything and the issue persists.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @amarudare,
    First of all, I can see that the APO mode has been enabled in your Cloudflare dashboard. Moreover, in the response header, the most important header is missing i.e. the cache-control header.

    Moreover, I have been able to replicate the issue on one of my testing sites. While we work on a fix to this, you can use the .htaccess file to ensure that for the wp-cron.php file the following header is set:

    cache-control: no-store, no-cache, must-revalidate, max-age=0

    Will keep you posted, as we figure this issue out and push a patch.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @amarudare,
    I would also like you to say that currently this issue can be seen only if you do not have any specific cache-control header set for wp-cron.php file and have enabled caching by using the Cloudflare Page Rule Mode (default mode).

    On the other hand, if you enable the worker mode (under cache tab inside plugin settings) you won’t face this issue on the worker mode (personally tested just now). I would suggest you to use the worker mode for a while (if you can) until we issue a patch for this.

    Plugin Author Salvatore Fresta

    (@salvatorefresta)

    Hi @amarudare ,
    I added an htaccess rule on 4.4.1 version to force the cache bypass for wp-cron.php

    I’m marking this thread as resolved. If you have other issues, please open a new ticket. Thank you so much for your support!

    Thread Starter Amar

    (@amarudare)

    Thanks @isaumya and @salvatorefresta.

    @isaumya : I understand. I do not have Cloudflare APO enabled but I had the Cloudflare plugin. I have uninstalled it.

    I have updated the app and forced cleared all cache but the problem persists.

    Is there a setting that I have to change or is the htaccess rule set by default. In either case can you please share the complete rule that I can add to the htaccess file?

    Thanks.

    Thread Starter Amar

    (@amarudare)

    @salvatorefresta Interestingly the “www.” address of the wp-cron web page shows the CACHE status as dynamic and that page is being served from the server I guess.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi @amarudare,
    As @salvatorefresta has pushed a fix for this. So whether you are using the default page rule mode or the worker mode, you should not be having any issue now. If you do face the issue, let us know.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.