• Resolved m22878

    (@m22878)


    What is the point of this plugin if this isn’t possible? You have WooCommerce listed as one of the plugins it works with, but you cannot even add something to your cart without a cookie. It wasn’t doing the static HTML caching until I selected the option to strip cookies, but then the site doesn’t work, because you cannot add something to your cart.

    Am I missing something here? Basically any and every site uses cookies for all sorts of things, so that limits the use of the plugin to very basic sites that basically have no real functionality, doesn’t it?

    But that goes for CF, in general, if you really cannot do static HTML caching using their service on a site with cookies, because caching static assets is NOTHING, you still rely on the response from your server, so it doesn’t speed up your site like static HTML caching does. Not even close, which I thought is the whole point of this plugin.

    And what is the point of the cache buster if when logged in the pages are using cookies, so CF won’t cache them anyway? I must be missing something.

    Does CF only not work when a cookie is set but otherwise will work on the page? For instance, if you visit a page for the first time it sets a cookie, but then on the next visit it doesn’t set the cookie, it just requests the cookie already set. In a case like that, would CF serve a static HTML page to the user?

    • This topic was modified 9 months, 3 weeks ago by m22878.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter m22878

    (@m22878)

    Follow up, is it possible to ignore certain cookies, so that even if a particular response cookie is on a page it will still serve a static HTML page? I thought I saw that as an option under the worker settings. You can put a specific cookie name there and it will still cache any page that response cookie is on? Because I have one cookie for JetMenu that actually is a response on every page for some reason and maybe that’s why the static HTML cache isn’t being served, because I think CF doesn’t serve a static HTML page only if a response cookie is on the page but will if a request cookie is on the page.

    • This reply was modified 9 months, 3 weeks ago by m22878.
    Thread Starter m22878

    (@m22878)

    How can I strip just individual cookies? I don’t want to strip them all just certain ones. I thought the ignore cookie option under worker mode was it, but I guess that’s the opposite of what I want. Apparently, when you specify a cookie there you are telling CF to not serve cache on that page with the response cookie.

    Thread Starter m22878

    (@m22878)

    Okay, I’m finally starting to figure things out. That one response cookie that was on every page load is what confused me. I removed it now everything is working great. One question, I see you added woocommerce_ cookies to the worker to bypass the cache. Whenever you add something to you cart it slows down the entire site since it no longer serves cache. If you don’t have any dynamic content based on cart contents like in the header, can you just remove that cookie from the bypass list in the worker? I already have pages like cart and checkout bypassed. It seems unnecessary to slow the site down when I have no dynamic content related to cart items or any other WC related action, really.

    Plugin Contributor iSaumya

    (@isaumya)

    When cookies are added by the response header using set-cookie method Cloudflare or rather any reverse proxy will not cache this page considering the page content is dynamically dependent on cookie value.

    Most plugin devs don’t care about caching or performance and as a result they add all these cookies at the PHP level. If cookies are added at the JS level or is JS is used to take advantage of localStorage instead of cookie then this problem won’t be there. But most devs don’t do that.

    This is why you would see that pages that are loading Google Analytics (which loads a lot of cookies) are still cached. Cause these cookies are added at the JS level.

    The cache are bypassed for the woocommerce cookies cause it’s needed for woocommerce to function properly. Woo won’t function properly if the pages are being served from cache without those cookies.

    Thread Starter m22878

    (@m22878)

    Why is bypassing pages with Woocommerce cookies need for WC to function when you can view the entire WC store cached with no cookie so long as you don’t have something in your cart.

    It seems that proves what you are saying is wrong. Only if you have dynamic content that pertains to having something in your cart like perhaps a qty box in the header, which shows how many items are in your cart, might you have to bypass WC cookies, since then users would falsely see these qty markers in their headers.

    But without the cookies changing the site like that, why couldn’t you continue to view cached pages of the WC store so long as pages like /cart/, /checkout/ and /my-account/ are bypassed?

    This is a really big deal as putting something in your cart basically completely disables the static HTML caching which is what makes a store so fast in the first place.

    Plugin Contributor iSaumya

    (@isaumya)

    There are many variables involved here. Woocommerce cookies are not just for carts. It can be used in many different ways by many different extensions. For example you may have a section on your site that shows the item in your cart in the header or you may have a section that shows the recently viewed items.

    In all cases, cached pages will show you cached content and not the actual content that you want to see.

    Thread Starter m22878

    (@m22878)

    Yes, but I don’t have any of those types of extensions, meaning, if you have something in your cart, it’s literally impossible to tell unless you’re on the cart page, because there is no indication of any kind that something is in your cart via an icon in the header or a number that signifies how many items are in your cart etc.

    Similarly, there is no recently viewed items etc. Nothing on the site changes based on viewing the WC store. Every user sees the exact same thing even when something is in the cart, except on the cart page or checkout pages.

    Honestly, even when logged in, users see the exact same site, there is no name or anything that changes in the header or anywhere else on the site. The only real issue with caching logged in users are the comments. That is the only place where it shows a name when someone is logged in, but that’s WP posts not the WC store pages. And I have logged in users set to not cache, so that takes care of logged in commenter names from being cached.

    Plugin Contributor iSaumya

    (@isaumya)

    Maybe your site doesn’t have any of those functionalities outside of the cart page but many sites do. Be it a cart section in the header or recently viewed item or others.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can you really not do static HTML caching on pages with cookies?’ is closed to new replies.