package handlers import ( "net/http" ) // servePWAManifest serves the web app manifest with the spec-mandated // content type. Browsers will accept application/json but the Lighthouse // PWA audit and some installability checks demand application/manifest+json. func servePWAManifest(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/manifest+json; charset=utf-8") w.Header().Set("Cache-Control", "public, max-age=300") http.ServeFile(w, r, "dist/manifest.json") } // servePWAServiceWorker serves /sw.js with strict no-cache headers so that // service-worker updates take effect on the next page load. The SW itself // caches /assets/* — caching the SW file would invert that. func servePWAServiceWorker(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/javascript; charset=utf-8") w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") w.Header().Set("Service-Worker-Allowed", "/") http.ServeFile(w, r, "dist/sw.js") }