Hi @ravanh, thanks for using the Cookie Consent Block. Sorry to hear it hasn’t been working as expected.
It appears to depend on how pages were first cached by the Litespeed proxy server.
Did you get a chance to turn off Litespeed completely to confirm the conflict comes from there?
Could you check if Litespeed has an option to make sure the cookie Consent block’s JavaScript is excluded from any script deferral, delay, or minification settings? Optimization plugins often delay or combine JS files, which can prevent the consent script from reading the visitor’s stored preference in time, so the banner flashes or reappears before the script catches up.
You may also want to check if the issue is happening on all browsers and different devices (laptop, mobile, tablets).
Hi Erina, yes I tested with Litespeed caching disabled and then the Consent message works as expected.
Options like Combine / Minify / Defer JS are all OFF. I check on mobile and two browsers (but all based on Chromium).
I have not noticed this issue on other sites that I manage on the same platform with the same setup…
Hi @ravanh, it turns out this is a known compatibility issue (not yet fixed) between the Jetpack Cookie Consent Block and page caching plugins like LiteSpeed Cache.
Why this happens: The Cookie Consent Block decides whether to show the banner on the server side — when the page is being built, it checks for a cookie called eucookielaw. If the cookie is present, the banner HTML is left out entirely. The problem is that LiteSpeed Cache stores and serves the same pre-built HTML to all visitors. So if the page was first cached before you accepted cookies, every visitor (including you on return visits) gets served that cached version regardless of whether the eucookielaw cookie is already set in their browser.
Here’s some ways to fix it with Litespeed:
Method 1 — Add eucookielaw to LiteSpeed’s Vary Cookies setting
This should LiteSpeed to maintain separate cached versions of each page, one for visitors who haven’t accepted cookies yet (no eucookielaw cookie) and one for those who have.
- In your WordPress dashboard, go to LiteSpeed Cache → Cache → Advanced tab.
- Find the Vary Cookies field.
- Enter
eucookielaw on its own line.
- Save, then purge all cache (LiteSpeed Cache → Toolbox → Purge All).
Method 2 — Exclude the cookie consent JavaScript from LiteSpeed’s JS optimization
This prevents LiteSpeed from deferring or delaying the script that handles the “Accept” button click, which could interfere with the cookie being set properly.
- Go to LiteSpeed Cache → Page Optimization → Tuning tab.
- In the JS Excludes field, add
cookie-consent on its own line.
- In the JS Deferred/Delayed Excludes field, also add
cookie-consent on its own line.
- Save, then purge all cache again.
Important Note: do NOT use “Do Not Cache Cookies” for this
You might be tempted to add eucookielaw under LiteSpeed Cache → Cache → Excludes → Do Not Cache Cookies, but please avoid this. That setting disables caching entirely for any page request where the cookie is present. Since the eucookielaw cookie is set site-wide once a visitor accepts, this would effectively turn off caching for all returning visitors across your entire site.
Please, give the above a try, and let us know if you still need help.