Edge Caching With Stale-While-Revalidate & Surrogate Keys for Dynamic SEO
Uncached origin SSR stalls under bot spikes and damages crawl capacity. Combining edge stale-while-revalidate with granular cache tags achieves instant freshness at CDN speed.
Dmitry K., Technical SEO Lead · SEO Space
Indexation benchmark targets
- Edge TTFB
- < 50ms globally
- Cache directive
- s-maxage=3600, swr=86400
- Invalidation
- Tag-based Surrogate-Key purge
Why Origin-Bound SSR Suffers Crawl Throttling Under Bot Bursts
When Googlebot, Bingbot, and AI fetchers sweep a 50,000-page catalog simultaneously, uncached Node or PHP origins spike from 120ms to 1,400ms TTFB. Search engines react immediately by shrinking allocated crawl rate.
Serving public HTML from the CDN edge with stale-while-revalidate absorbs arbitrary bot bursts effortlessly at 30–50ms TTFB.
Cache-Control: public, max-age=0, must-revalidate
CDN-Cache-Control: public, s-maxage=3600, stale-while-revalidate=86400
Cache-Tag: category-valves, sku-4490 Stopping Marketing Cookies from Bypassing HTML Cache
Most edge caches silently bypass caching whenever an incoming request carries a session cookie or tracking UTM parameter.
- Configure CDN cache keys to ignore marketing query strings (utm_*, fbclid, gclid) and session cookies on public catalog routes.
- Emit Surrogate-Key / Cache-Tag headers per SKU and category so price updates purge only affected pages in <200ms.
- Keep browser cache conservative (max-age=0) while letting CDN POPs hold s-maxage for hours or days.
Cache Layer Governance Matrix
Separate browser freshness from edge durability.
| Layer | Recommended Header | Effect |
|---|---|---|
| Browser | max-age=0, must-revalidate | Users never stuck on stale edits |
| CDN Edge POP | s-maxage=3600, stale-while-revalidate=86400 | Instant bot TTFB without origin load |
| Webhook Purge | Purge by Cache-Tag on save | Price/stock updates live within seconds |
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.