Support » Plugin: Super Page Cache for Cloudflare » cf-cache:EXPIRED after a while

  • Resolved p231

    (@p231)


    Hello,

    and first thank you for your wonderful plugin. I have set it on my woocommerce page along with Autoptimize for minifying assets. I have although two problems:

    1. I get an cf-cache:EXPIRED header after a while (10-20min) when I visit the same page. The output is as follows:

    alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
    cache-control: s-maxage=31536000, max-age=60
    cf-apo-via: origin,cookie
    cf-cache-status: EXPIRED
    cf-ray: 6b1c6a1b5a756983-FRA
    content-encoding: br
    content-type: text/html; charset=UTF-8
    date: Sun, 21 Nov 2021 19:44:48 GMT
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    last-modified: Sun, 21 Nov 2021 12:14:50 GMT
    link: <https://mydomain.com/wp-json/>; rel="https://api.w.org/", <https://mydomain.com/wp-json/wp/v2/product/20155>; rel="alternate"; type="application/json", <https://mydomain.com/?p=20155>; rel=shortlink
    nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
    report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=M6lCpIhb4PhnGG6fgzMwqXoprRkYhT3ve9oBhHR5uSwT4LiJuyAierxRjXyjYQ7lhNUXBgnonZEJR4u%2BAmcQl%2F7NLIFz4J8bKT6XcAPrrHLuZOF%2B6OUotNcrrCpRWfVmumHKzR167wVSF85sD70iyrMx"}],"group":"cf-nel","max_age":604800}
    server: cloudflare
    vary: Accept-Encoding,User-Agent
    x-powered-by: PHP/7.2.34
    x-powered-by: PleskLin
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-wp-cf-super-cache-cache-control: s-maxage=31536000, max-age=60
    x-wp-cf-super-cache-cookies-bypass: swfpc-feature-not-enabled

    In Cloudflare, there is the standard “cache everything” rule for mydomain.com/* and the site response headers are looking good to me. Despite this I experience expired headers every other time. On reloading I get a HIT from cloudflare.

    2. The cache preloader doesn’t work on my site as intended. I use the sitemap feature and it’s showing in the log that it reads the sitemap successfuly and will preload 359 urls and then it starts preloading. But while it is working for 50-100 urls, then it stops with a “preloading complete message”.

    Can you help me here? When you need access to the site, please allow communication via email.

    Thank you very much!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter p231

    (@p231)

    Addition to question 2 (Logs in high verbosity):

    [2021-11-21 10:06:11] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/product-sitemap.xml
    [2021-11-21 10:06:13] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/post-sitemap.xml
    [2021-11-21 10:06:14] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/page-sitemap.xml
    [2021-11-21 10:06:16] [cloudflare::start_preloader_for_all_urls] Getting last published posts for post types: Array
    (
        [0] => post
        [1] => page
        [2] => product
        [3] => mailpoet_page
        [4] => xlwcty_thankyou
        [5] => avada_portfolio
        [6] => avada_faq
    )
    [2021-11-21 10:06:16] [cache_controller::start_cache_preloader_for_specific_urls] Adding these URLs to preloader queue: Array
    (
    [0] => XXX
    ...
    [359] => XXX
    [2021-11-21 10:06:19] [preloader::task] Preloading URL XXX
    
    #and so on for 50-100 urls approx. but not for all.
    
    [2021-11-21 10:12:08] [preloader::task] Preloading complete
    
    
    • This reply was modified 7 months, 1 week ago by p231.
    Plugin Contributor Saumya Majumder

    (@isaumya)

    Hi,
    First of all the response header you have provided I can see that you are using the the official Cloudflare plugin along with APO while using this plugin. Please note that you cannot use both the plugin at the same time. You either have to use this plugin or the official cloudflare plugin.

    If you choose to use this plugin then please make sure you have disabled APO inside Cloudflare dashboard and then delete the official cloudflare plugin from your site.

    Also in the Cloudflare dashboard make sure that Browser Cache TTL is set to Respect Hedaer. Also please share your site URL and a screenshot of the page rule section so that I can check if it is perfectly alright.

    Coming to the preloader. Once the system fetches out all the URLs that it needs to preloader, it asynchronously preload multiple URLs at a go. So, you might see 50/100 response in log but it should have completed the whole preloader unless it has been stopped manually from the plugin settings preloader section.

    Thread Starter p231

    (@p231)

    Hello @isaumya,

    thank you very much. Indeed I have missed the point that APO should be turned off to work properly. As this is a clients site, which Cloudflare Account I don’t have easily access to, i have to ask the client first. Then I can post you screenshots.

    As for the preloader part, ok, so it should be working fine. Thank you!

    Thread Starter p231

    (@p231)

    Hello @isaumya,

    first thank you for the resolution of the expired cache problem with APO on. Without APO it seems now to work properly.

    As of the preloader, I’m not so sure though. I let the preloader run until i get “preloading complete” in the logs. In the configuration of your plugin I entered the links to my sitemaps:

    /product-sitemap.xml
    /post-sitemap.xml
    /page-sitemap.xml
    /category-sitemap.xml

    …and like i said i see the log message, that the plugin will preload e.g. 350 urls, then approximately 50-100 urls are shown as preloaded. But i can confirm that if I let run an another cache primer tool like OCP (https://patrickmn.com/projects/ocp/) that approx. only 20% of the links in the sitemaps were preloaded.

    Thank you for your help!

    Plugin Contributor Saumya Majumder

    (@isaumya)

    If in the log you are seeing preloading is completed then the system should have gone though all the URLs as only after that the message will be printed in the logs.

    Thread Starter p231

    (@p231)

    Then there must be an another problem, maybe with an another plugin, as I clearly can see that not all links are preloaded. Also when I go through the pages, I get some MISS headers which are then transform to HIT when I reload the page. I keep you updated with my findings. Thank you.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    If your pages don’t have constant users CF will remove the cache. Please read this: https://acnam.com/untold-truths-of-cloudflare-cdn/#cloudflare-cache-creation-replication-storage

    Thread Starter p231

    (@p231)

    Hm.. it happens right minutes after the testing and our analytics says that there are approx. 15K unique visitors on the page per month. So the respect headers and TTL has no impact on how cloudflare caches things?

    Thread Starter p231

    (@p231)

    If that is the case, I would go back to FastCGI Caching on nginx, which is also free for me and have some more configuration options. Cloudflare was a requirement from the client.

    • This reply was modified 7 months ago by p231.
    Thread Starter p231

    (@p231)

    Using OCP would be another option if we keep Cloudflare Cache. So there is no real problem, but I only want to understand, what is going on there.

    Plugin Contributor Saumya Majumder

    (@isaumya)

    So the respect headers and TTL has no impact on how cloudflare caches things?

    – Did not get your question. This plugin sets header value to tell Cloudflare to cache the items for 1 year. But if you have pages or contents that does not get much traffic then Cloudflare won’t cache it for 1 year. But if it is a frequent page which is visited by many people then Cloudflare will keep the item in cached. It’s basically when we are setting the s-maxage we are telling CF that we want these items to be cached for 1 year. But if that item has no traffic CF won’t waste it’s server storage keeping the items still in cached.

    Even with that Cloudflare will give you a million times better performance than FastCGI as with cloudflare when items are cached the request won’t even travel to the origin server and handles by your nearest CF CDN edge server. And even if an item is not cached, after the 1st request it will get cached.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘cf-cache:EXPIRED after a while’ is closed to new replies.