LiteSpeed

LiteSpeed ESI explained: cache pages with personal parts

What Edge Side Includes (ESI) are in LiteSpeed Cache, how they let you cache pages that contain carts, greetings or nonces, when to enable ESI and how to test it.

AdvancedWordPress on LiteSpeed3 min read

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

  1. The page is stored in the public cache with placeholders, called ESI blocks, where personal content goes.
  2. When a visitor requests the page, LiteSpeed serves the cached page and fetches each ESI block separately.
  3. 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

SituationESI helps?
Shop with a header mini cartYes
Membership site with personal greetingsYes
Forms that include a nonce on cached pagesYes, LiteSpeed Cache can serve nonces through ESI
Simple blog with no logged-in visitorsNo; plain caching is enough

Enable ESI

  1. Go to LiteSpeed Cache → Cache → ESI.
  2. Set Enable ESI to On.
  3. Cache Admin Bar and Cache Comment Form: On, so these parts are served as ESI blocks.
  4. Under ESI Nonces, add nonce names used by plugins that break on cached pages, if the plugin's documentation lists them.
  5. 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-cache hit or hit,private for 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.

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.