Edge Side Includes (ESI) & Donut Caching: Personalization Without Losing Edge Cache
Disabling CDN HTML caching for logged-in sessions or B2B price tiers kills TTFB. Donut caching separates static SEO shells from user slots.
Dmitry K., Technical SEO Lead · SEO Space
1. Stopping Session Cookies from Busting Public HTML Caches
When an e-commerce stack sets session or cart cookies on first visit and disables CDN caching (`Cache-Control: private`) across all templates, every bot and returning buyer hits origin SSR.
Donut caching—either via Edge Side Includes (ESI) at the CDN or tiny client/edge islands—keeps the indexable product shell 100% cacheable while streaming dynamic stock or account state separately.
<!-- Cached public HTML shell served at edge (<50ms) -->
<div id="user-badge" data-esi-src="/api/session-summary"></div> 2. Keeping Googlebot Canonical Pricing Consistent with JSON-LD
Ensure unauthenticated crawler requests always receive the baseline public price both inside the cached HTML fragment and embedded `Offer` structured data.
Choose edge assembly or lightweight hydration islands over uncached origin SSR.
| Pattern | Edge Cache Hit Rate | Googlebot Parity |
|---|---|---|
| Edge ESI / Worker Fragment | 95%+ on full shell | 100% canonical public pricing |
| Cached Shell + Small API Island | 98% on HTML document | Core specs & schema purely static |
| Per-Session Origin SSR | < 10% edge hits | High TTFB spikes & crawl throttling |
- Strip non-essential tracking cookies in CDN VCL/Worker rules before cache lookup on GET catalog URLs.
- Reserve fixed pixel dimensions around dynamic personalization slots to guarantee zero CLS.
- Vary edge cache strictly by coarse currency/region path (`/us/`, `/eu/`) rather than per-user session IDs.
Need this indexation setup audited on your domain?
Send your website URL. We check raw HTML parity, log crawl hits, canonical discipline, and sitemap architecture manually within 24 hours.