• Resolved cuongpham259

    (@cuongpham259)


    Hello!

    I’m having a small problem using the Super Page Cache for Cloudflare with Varnish.

    I have enabled the function “Automatically purge single post cache when a new comment is inserted into the database or when a comment is approved or deleted“.

    Then I turned on Varnish Support so that the plugin automatically deletes varnish when the plugin clears the cache

    However, the process of saving Post is extremely SLOW. I checked the LOG and saw that Varnish deleted many pages related to the current article, including author pages, category pages, blog page, feed…

    I know this is not a bug, it is correct practice.

    However, because there are too many related pages, my site is quite slow. I want to ask if there is any way to filter out pages to be deleted with Varnish?

    I only need to delete exactly 1 page url that is updating the content. There is no need to delete related pages.

    So is there a filter or way to do this?
    Thanks a lot!

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

    (@isaumya)

    Hi @cuongpham259,
    When using this plugin as everything is being cached at the edge, you really don’t need to use Varnish. Adding varnish will just add more complexity without giving you much benefit.

    I want to ask if there is any way to filter out pages to be deleted with Varnish?

    Unfortunately no.

    Thread Starter cuongpham259

    (@cuongpham259)

    Hi @isaumya

    I have a php site in a subfolder, so turning on Varnish helps a lot.

    If I remember correctly there is a php file specifically for varnish. Are there any suggestions to fix the code without calling the Urls related to the $url being removed?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @cuongpham259,
    I honestly don’t know how Varnish can help if you have a site in a sub folder when the site content is cached and served from the CDN edge.

    If I remember correctly there is a php file specifically for varnish. Are there any suggestions to fix the code without calling the Urls related to the $url being removed?

    If you check the FAQ tab of the plugin settings you will see there is a filter that allows you to add content tyo related URLs array. But there is no way to remove things from there.

    Thread Starter cuongpham259

    (@cuongpham259)

    Hi @isaumya

    Thanks for the suggestion.
    I tried using custom code with HOOK before you mentioned it. However, it did not work at that time.

    I just reviewed the code, and asked ChatGPT, now it works.
    Using HOOK is many times faster than setup in Plugin.

    Thanks for your help.
    Have a nice day!

    • This reply was modified 2 years, 7 months ago by cuongpham259.
    Plugin Contributor iSaumya

    (@isaumya)

    Glad to know your problem has been resolved. πŸ™‚

    Thread Starter cuongpham259

    (@cuongpham259)

    Hi @isaumya

    I just discovered a problem with my current website. This is the LOG

    [2023-10-19 01:21:44] [cache_controller::purge_cache_queue_job] I’m the purge cache cronjob
    [2023-10-19 01:21:44] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 34962 and related contents – Fired action: clean_post_cache
    [2023-10-19 01:21:45] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2023-10-19 01:21:45] [cache_controller::purge_cache_queue_job] Cache purging complete

    However, the cache is not actually cleared. It only deletes when I use the button in the plugin.

    Currently the function “Automatically purge single post cache when a new comment is inserted into the database or when a comment is approved or deleted” does not work.

    How to investigate the cause?

    I changed the theme and disabled all plugins. There’s no conflict, just the function doesn’t work.

    Thread Starter cuongpham259

    (@cuongpham259)

    Update:

    It seems the problem was just a late delivery. It takes 15-20 seconds for the Cache to be cleared and updated. I tested it on another website, it delivered immediately.

    It seems like I installed something on the Cloudflare website without remembering, causing the cache clearing process to be delayed πŸ™

    Plugin Contributor iSaumya

    (@isaumya)

    Yes, Cloudflare takes upto 30 seconds to clear the cache.

    Thread Starter cuongpham259

    (@cuongpham259)

    Hi @isaumya

    Everything seems fine, however I discovered a strange phenomenon with JetEngine Plugin v3.2.6

    If I activate the plugin. Accessing the page for the first time is always cf-cache-status: BYPASS. Then there will be MISS and then HIT.

    That means instead of accessing it the first time to create the cache, you now have to access it twice.

    This is quite new, I can’t create a dev site for you to test because JetEngine requires a license πŸ™

    • This reply was modified 2 years, 7 months ago by cuongpham259.
    Thread Starter cuongpham259

    (@cuongpham259)

    Found the cause. JetEngine has a function called “Data Store”, if it is set to save in Session or Cookie, the first access will be BYPASS.

    I can temporarily switch to saving in Metadata, but hopefully you can modify it in the future to ignore it, because there are things that only need to be saved in one session…

    Thanks a lot!

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @cuongpham259,
    Glad to hear that your problem has been resolved and you have found a solution. If that JetEngine modile is adding a cookie in the response header using set-cookie, Cloudflare will never cache that page as CF will see the cookie in the response header and thinks that the cookie value might be used to dynamically generate the page content.

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

The topic ‘Help with Cache Clearing with Varnish’ is closed to new replies.