The _lscache_vary cookie is a functional cookie used by LiteSpeed Cache to manage caching for different user states on websites. It serves the following purposes:
-
Stores the role of a logged-in user
-
Provides prevention of cached page
-
Distinguishes between logged-in and non-logged-in users
This cookie is typically set with a 2-day expiration period. It helps the server determine which version of a cached page to serve to a user based on their login status.
The _lscache_vary cookie is essential for the proper functioning of LiteSpeed Cache, especially when dealing with different user roles and logged-in states on websites. It ensures that users receive the appropriate cached content based on their authentication status.
In some cases, such as when Guest Mode is enabled in WordPress, the _lscache_vary cookie may be set even for non-logged-in users to facilitate certain caching features which may cause an issue with users who don’t want cookies on their website and do not have a consent management banner to let users opt-in or opt-out as required by certain laws.