• Resolved dbackeus

    (@dbackeus)


    Hi, I’ve installed + enabled + configured the plugin and enabled caching. However when editing pages cache is not purged automatically.

    Manually clicking the “Purge cache for this post only” button from the admin menu works fine.

    The WordPress site is hosted on wpengine.com but is sitting behind a reverse proxy hosted on Heroku which in turn has Cloudflare in front. So it’s not a typical pure WordPress + Cloudflare deployment. However I don’t see why that should have anything to do with automated purging not working considering I can successfully purge the cache manually.

    Debug log output

    After editing a page I get the following log output but the cache is not purged at Cloudflare:

    [2022-01-27 08:31:35] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: clean_post_cache
    [2022-01-27 08:31:35] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: edit_post
    [2022-01-27 08:31:35] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: clean_post_cache

    After clicking the “Purge cache for this post only” I get the following log output and the purge is successfully purged:

    [2022-01-27 08:33:07] [cache_controller::purge_wpengine_cache] Purge WP Engine memcached cache
    [2022-01-27 08:33:07] [cache_controller::purge_wpengine_cache] Purge WP Engine varnish cache
    [2022-01-27 08:33:07] [cache_controller::start_cache_preloader_for_specific_urls] Adding 15 URLs to preloader queue
    [2022-01-27 08:33:08] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/
    [2022-01-27 08:33:08] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2022-01-27 08:33:08] [cache_controller::ajax_purge_single_post_cache] Purge Cloudflare cache for only post id 324 and related contents
    [2022-01-27 08:33:11] [preloader::task] Unable to find a valid URL to preload. Exit.
    [2022-01-27 08:33:11] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/2/
    [2022-01-27 08:33:16] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/3/
    [2022-01-27 08:33:19] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/4/
    [2022-01-27 08:33:22] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/5/
    [2022-01-27 08:33:26] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/6/
    [2022-01-27 08:33:30] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/7/
    [2022-01-27 08:33:34] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/8/
    [2022-01-27 08:33:37] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/9/
    [2022-01-27 08:33:41] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/10/

    How can I resolve this issue or troubleshoot further?

    • This topic was modified 4 years, 4 months ago by dbackeus.
    • This topic was modified 4 years, 4 months ago by dbackeus.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @dbackeus,
    Hmm… this seems wired I want you to do a few things:
    1. Inside the plugin setting > others tab set the log verbosity to HIGH so the log gives more info.

    After that update the post and then wait for a few min. If the cache is not automatically purged send me the log of that situation. This time as log verbosity is set to high, you should get much more info.

    2. It is really not recommended to use more than a one-page caching system on a site as the chances of conflict are high. As I can see you have Varnish enabled inside WP Engine which is an aggressive server-level page caching. You really do not need any server-level page caching when you are using Cloudflare caching cause most of your request will be served by Cloudflare CDN and will not reach to your server.

    I will however recommend you to enable the “Tired Cache” inside the CF dashboard > Caching tab.

    3. If you have a website with good traffic, you really do not need to enable the preloading. It is mainly for sites which has almost no to low visits.

    Anyways try the above and send me the high verbosity log of the situation after post update/publish.

    Thread Starter dbackeus

    (@dbackeus)

    Thanks for the pointers. I’ll look into tweaking the overall configuration later. First priority is getting the auto-purge on edit to work…

    Here is the output in verbose mode. For the editing a page I still see the same output as before:

    [2022-02-02 12:20:00] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: clean_post_cache
    [2022-02-02 12:20:00] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: edit_post
    [2022-02-02 12:20:01] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 324 and related contents - Fired action: clean_post_cache

    5 minutes later I was still getting a HIT so I clicked “purge cache for only this page” and got the following log:

    [2022-02-02 12:25:46] [cloudflare::purge_cache_urls] Request URL: https://api.cloudflare.com/client/v4/zones/7894dbf7b2782c47fabb1db9efbc36f3/purge_cache
    [2022-02-02 12:25:46] [cloudflare::purge_cache_urls] Request Body: {"files":["https:\/\/www.mnd-staging.com\/se-sv\/","https:\/\/www.mnd-staging.com\/se-sv\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/2\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/3\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/4\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/5\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/6\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/7\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/8\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/9\/","https:\/\/www.mnd-staging.com\/se-sv\/page\/10\/","https:\/\/www.mnd-staging.com\/?taxonomy=post_translations&term=pll_61b649b5bd884","https:\/\/www.mnd-staging.com\/se-sv\/blogg\/author\/siteadmin\/","https:\/\/www.mnd-staging.com\/se-sv\/blogg\/author\/siteadmin\/feed\/","https:\/\/www.mnd-staging.com\/","https:\/\/www.mnd-staging.com\/se-sv\/blogg\/"]}
    [2022-02-02 12:25:47] [cloudflare::purge_cache_urls] Response: {
      "result": {
        "id": "7894dbf7b2782c47fabb1db9efbc36f3"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2022-02-02 12:25:47] [cache_controller::purge_wpengine_cache] Purge WP Engine memcached cache
    [2022-02-02 12:25:47] [cache_controller::purge_wpengine_cache] Purge WP Engine varnish cache
    [2022-02-02 12:25:47] [cache_controller::start_cache_preloader_for_specific_urls] Adding these URLs to preloader queue: Array
    (
        [0] => https://www.mnd-staging.com/se-sv/
        [2] => https://www.mnd-staging.com/se-sv/page/2/
        [3] => https://www.mnd-staging.com/se-sv/page/3/
        [4] => https://www.mnd-staging.com/se-sv/page/4/
        [5] => https://www.mnd-staging.com/se-sv/page/5/
        [6] => https://www.mnd-staging.com/se-sv/page/6/
        [7] => https://www.mnd-staging.com/se-sv/page/7/
        [8] => https://www.mnd-staging.com/se-sv/page/8/
        [9] => https://www.mnd-staging.com/se-sv/page/9/
        [10] => https://www.mnd-staging.com/se-sv/page/10/
        [11] => https://www.mnd-staging.com/?taxonomy=post_translations&term=pll_61b649b5bd884
        [12] => https://www.mnd-staging.com/se-sv/blogg/author/siteadmin/
        [13] => https://www.mnd-staging.com/se-sv/blogg/author/siteadmin/feed/
        [14] => https://www.mnd-staging.com/
        [15] => https://www.mnd-staging.com/se-sv/blogg/
    )
    
    [2022-02-02 12:25:48] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/
    [2022-02-02 12:25:48] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2022-02-02 12:25:48] [cache_controller::ajax_purge_single_post_cache] Purge Cloudflare cache for only post id 324 and related contents
    [2022-02-02 12:25:51] [preloader::task] Unable to find a valid URL to preload. Exit.
    [2022-02-02 12:25:51] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/2/
    [2022-02-02 12:25:54] [preloader::task] Preloading URL https://www.mnd-staging.com/se-sv/page/3/
    Plugin Contributor iSaumya

    (@isaumya)

    As I can see the cache purging is working perfectly and CF API is also returning success. Have you tried disabling the preloader?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘purge_cache_on_post_edit not working’ is closed to new replies.