Service Workers & SEO: Preventing Stale HTML Shells & Bot Intercepts
Cache-first HTML Service Workers freeze outdated titles, prices, and canonical tags for months unless network-first strategies protect navigation.
Dmitry K., Technical SEO Lead · SEO Space
Indexation benchmark targets
- HTML cache strategy
- Network-first only
- App-shell pattern
- Avoid for public SSR
- Static asset TTL
- Cache-first hashed
Why App-Shell Service Workers Corrupt SEO Metadata
Classic SPA Service Workers intercept navigation requests and return a generic `/index.html` app shell immediately from cache—stripping page-specific titles, canonicals, and JSON-LD during updates.
Even for human users returning from search, stale cache-first HTML displays expired pricing and broken bundle hashes after deployments.
- Restrict Service Worker `Cache-First` strictly to content-hashed JS, CSS, and font assets.
- Use `Network-First` with short timeout fallback for HTML navigation requests.
- Never install or register Service Workers via blocking scripts on initial Googlebot landing passes.
Enabling Navigation Preload to Eliminate SW Boot Delay
If you keep a Service Worker for offline reliability, activate `navigationPreload.enable()` so browser network fetches run in parallel with worker boot.
self.addEventListener('activate', (event) => {
event.waitUntil(self.registration.navigationPreload?.enable());
}); Safe Caching Policies by Resource Type
Separate immutable static assets cleanly from dynamic SSR HTML routes.
| Asset Class | Service Worker Strategy | SEO Safety Reason |
|---|---|---|
| SSR HTML Documents | Network-First (or bypass) | Keeps canonical, title & stock live |
| Hashed JS/CSS/Fonts | Cache-First immutable | Safe instant loads across pages |
| XML Sitemaps & Robots | Never intercept | Always direct fresh origin/CDN |
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.