Normally a page is either cached for everyone or not cached at all. ESI (Edge Side Includes) lets LiteSpeed cache most of a page publicly and fill in small personal parts, such as a mini cart, a "Welcome back, Sam" bar or a form security token, separately for each visitor.
Before you start
- A WordPress site with LiteSpeed Cache on a LiteSpeed Enterprise server (ESI is not available on OpenLiteSpeed). MdmHost servers run Enterprise.
- Page caching already working (see checking the cache header).
How ESI works
- The page is stored in the public cache with placeholders, called ESI blocks, where personal content goes.
- When a visitor requests the page, LiteSpeed serves the cached page and fetches each ESI block separately.
- Each block has its own cache rules: private (per visitor), public with a short TTL, or not cached.
The result: logged-in users and shoppers get mostly cached pages instead of fully uncached ones.
When to enable ESI
| Situation | ESI helps? |
|---|---|
| Shop with a header mini cart | Yes |
| Membership site with personal greetings | Yes |
| Forms that include a nonce on cached pages | Yes, LiteSpeed Cache can serve nonces through ESI |
| Simple blog with no logged-in visitors | No; plain caching is enough |
Enable ESI
- Go to LiteSpeed Cache → Cache → ESI.
- Set Enable ESI to On.
- Cache Admin Bar and Cache Comment Form: On, so these parts are served as ESI blocks.
- Under ESI Nonces, add nonce names used by plugins that break on cached pages, if the plugin's documentation lists them.
- Save and click Purge All.
For logged-in users, also enable Cache Logged-in Users in Cache → Cache so their pages use the private cache with ESI.
Warning: Test carefully with two browsers and two accounts. Personal data must never appear for another visitor.
Test ESI
- Log in as two different users in two browsers and check greetings, carts and account menus show the right person.
- Add an item to the cart in one browser; the other must stay empty.
- Check headers: cached pages still show
x-litespeed-cachehit orhit,privatefor logged-in users.
Shop-specific settings are in LiteSpeed Cache for WooCommerce.
Troubleshooting
Widget shows stale content
The block is cached publicly. Set the widget's ESI option to private or no-cache in Appearance → Widgets, where LiteSpeed adds ESI settings to each widget.
Forms fail with "nonce expired"
Add the plugin's nonce to ESI Nonces, or exclude the form page.
Frequently asked questions
Does ESI slow pages down?
Slightly compared with a fully public cache, because blocks are assembled per request, but much faster than an uncached page.
Do I need ESI with WooCommerce?
Not strictly; WooCommerce works safely without it. ESI simply lets more pages be cached for shoppers.
Can I use ESI on non-WordPress sites?
ESI is a LiteSpeed server feature; the official extensions for other platforms use it in different ways. Custom apps need ESI tags in their templates.
Is ESI on by default?
No. It is off by default in LiteSpeed Cache; enable it only when you need cached pages with personal parts.
