Wordpress LScache Plugin: Honoring a cookie while still caching
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi there, I need some help with a custom cookie in a WordPress site (PHPs setcookie command). I am using this cookie to show some content (if the cookie is set, then dont show XYZ etc.). Everything works as intended when the Litespeed plugin is deactivated. When LS plugin is activated, the cookie is set correctly, but Chrome completely ignores it. Firefox ignores it twice, but acknowledges it the third time (?) etc. So unpredictable behavior all around. So I am basically looking for a way to honor the changes in a cookie, while still caching the PHP page that set this cookie. Is that possible? This hasnt something to do with any browser. If a cookie is set and content changes if this cookie is set a different copy of the cache with same URL must be created. For this LScache uses cache vary. Documentation knows a lot about this: https://docs.litespeedtech.com/lscache/devguide/advanced/#cache-varies This should do what you need. Set your cookie name for my_cookie. RewriteRule .? - [E=Cache-Vary:my_cookie] You can also disable caching if your cookie is set. See plugin settings. Thanks! I searched for the documentation but could not find, so much obliged for the direct link. Disabling caching when cookie is set is no option, because it will slow down the page too much?. Try the code from my last post.
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference