X-LiteSpeed-Cache-Control
The HTTP X-LiteSpeed-Cache-Control response header is an unofficial HTTP header providing LiteSpeed-specific cache directives to the LSCache engine, extending the standard Cache-Control header with server-level Caching instructions.
Note
The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.
Usage
LiteSpeed Web Server reads this header from the application response to determine how LSCache stores and serves the content. While the standard Cache-Control header controls browser and CDN behavior, X-LiteSpeed-Cache-Control targets the server-level cache layer exclusively. Browsers and intermediary proxies ignore this header.
The directives are typically set by a caching plugin such as the LiteSpeed Cache plugin for WordPress. The plugin evaluates each response and adds the appropriate directives based on the content type, user session state, and plugin configuration. LiteSpeed Web Server reads these directives, caches the response accordingly, and strips the header before sending the response to the client.
Directives
public
The public directive marks the response as cacheable for
all visitors. LSCache stores a single shared copy and serves
the same content to every anonymous request.
private
The private directive restricts the cached copy to a
specific user session. LSCache maintains separate cache
entries per logged-in visitor. This is common for pages
displaying user-specific content like account dashboards
or shopping carts.
max-age
The max-age=N directive sets the time-to-live for the
cache entry in seconds. After N seconds, LSCache treats
the entry as stale and fetches a fresh copy from the
application. Common values in production range from
3600 (one hour) to 604800 (seven days).
no-cache
The no-cache directive tells LSCache to skip caching
for the response entirely. The request passes through
to the backend application every time. This appears on
dynamic pages like sitemaps, search results, and pages
with active user sessions.
esi
The esi=on directive enables Edge Side Includes
processing for the response. ESI allows LSCache to
cache the overall page while leaving marked blocks
dynamic. Each ESI block is fetched and assembled on
every request, combining cached and fresh content in
a single response.
no-vary
The no-vary directive prevents vary cookies from being
included in the LSCache cache key. Without this directive,
LSCache creates separate cache entries per cookie
combination when cookies are configured as vary fields.
The no-vary directive strips cookie-based variation from
the key, causing LSCache to serve the same cached copy
regardless of cookie differences.
no-store
The no-store directive instructs LSCache not to store
the response at all. Similar to no-cache but more
explicit about storage intent.
s-maxage
The s-maxage=N directive sets the cache lifetime in
seconds specifically for shared (public) LSCache storage,
overriding max-age for the shared cache tier while
leaving private cache behavior unchanged.
max-stale
The max-stale=N directive allows LSCache to serve a
stale cached response up to N seconds past its
expiration before fetching a fresh copy from the backend.
Example
A public page cached for seven days. The public directive
allows LSCache to serve the same cached copy to all
visitors, and max-age=604800 sets the expiration to
604800 seconds (seven days).
X-LiteSpeed-Cache-Control: public, max-age=604800
A shorter cache lifetime of one hour for content updated
more frequently. The 3600 second TTL balances caching
performance with content freshness.
X-LiteSpeed-Cache-Control: public, max-age=3600
A private cache entry for logged-in visitors. LSCache stores a separate copy per user session with a 30-minute TTL. This keeps personalized content cached without exposing the data to other visitors.
X-LiteSpeed-Cache-Control: private, max-age=1800
A page excluded from caching entirely. The no-cache
directive forces every request through to the backend
application.
X-LiteSpeed-Cache-Control: no-cache
Takeaway
The X-LiteSpeed-Cache-Control header gives the application direct control over how LiteSpeed's LSCache engine stores and serves responses. The directives determine cache scope, lifetime, and special processing modes at the server level, independent of standard Cache-Control behavior.