Web & App Dev Engineering Playbook Updated 2026-11-16 3 min read PWA · Service Workers · Web App Manifest

Production PWA Development: Web App Manifests, Safe Service Workers & Offline UX

Misconfigured cache-first service workers trap returning users and bots on stale HTML releases for weeks. Engineering network-first document caching gives app installability without breaking updates.

Dmitry K., Technical SEO Lead · SEO Space

1. Choosing Cache Strategies That Never Trap Old HTML Versions

Caching HTML pages aggressively inside Service Worker CacheStorage breaks instant rollouts: returning visitors see outdated pricing and broken chunk hashes after deployments. Meanwhile, hashed JS and font assets remain immutable forever.

Separating network-first navigation handling for HTML documents from cache-first immutable asset rules delivers near-instant app speed with zero stale content bugs.

  • Always pair HTML navigation requests with a network-first strategy falling back to an explicit /offline.html shell.
  • Include complete manifest.webmanifest fields: name, short_name, start_url, display: standalone, and maskable 192/512 PNG icons.
  • Register service workers strictly after window load so main-thread startup stays fast.

2. Safe Network-First Navigation Handler in sw.js

Prevent stale HTML cache poisoning across releases.

self.addEventListener('fetch', (event) => {
  if (event.request.mode === 'navigate') {
    event.respondWith(
      fetch(event.request).catch(() => caches.match('/offline/'))
    );
  }
});

3. Cache Policy Matrix by Resource Type

Match caching rules strictly to asset mutability.

Resource Type SW Cache Strategy Rationale
HTML Documents Network-First + offline fallback Guarantees fresh content and prices
Hashed _astro/*.js & .css Cache-First immutable Zero re-download across repeat visits
User API & Auth Calls Network-Only Prevents leaking or caching private session data

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.