Forum Replies Created

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

    (@wenape)

    We have the same issue. Also started appearing from 2.2.7.

    The content(a banner) didn’t appear when the cache was hit, only when missed. I did get it to work by editing .htaccess though:

    ### marker LOGIN COOKIE start ###
    RewriteRule .* - [E="Cache-Vary:wp-postpass_124e250c9dfea8eoe63758772526411e,next_lan"]
    ### marker LOGIN COOKIE end ###

    Now when I have the cookie set in my browser, the banner actually shows and cache hits as x-litespeed-cache: hit,private.

    I know this is not the best practice because it’s within ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##.

    How can I use it outside this block? Should I just include the following line: RewriteRule .? - [E=Cache-Vary:next_lan] outside the block by it’s own? Or maybe outside, but wrapped in <IfModule LiteSpeed> tags?

    I don’t know why the other methods didn’t work for me, maybe the headers where overriden or had some conflict with another plugin.

    • This reply was modified 4 years, 7 months ago by wenape.
    • This reply was modified 4 years, 7 months ago by Yui.

    I have a similar situation. I’m using a cookie to serve different versions of the same page. I tried your solution @hailite, but it’s not working correctly.

    The vary header is included, but only when cache is not hit:

    x-litespeed-cache: miss
    x-litespeed-vary: cookie=next_lan
    x-turbo-charged-by: LiteSpeed

    If the cache is hit, the vary header is nowhere to be found:

    x-litespeed-cache: hit
    x-turbo-charged-by: LiteSpeed

    It’s almost acting like a “passive” don’t cache certain cookies setting, meaning if for some reason the cache is not hit on some page (regardless of having the cookie), the x-litespeed-vary header will be included, but not otherwise.

    I get the same issue when using;

    add_action('init', function() {
       if (method_exists('LiteSpeed_Cache_API', 'vary_add')) { 
         LiteSpeed_Cache_API::vary_add('next_lan');
       }
    })

    I’m also using Cloudflare, don’t know if that affects cookies though.

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