Browser Error: Service Worker registration failed (Scope / HTTPS)

Service workers require HTTPS (or localhost) and cannot control paths outside their script directory.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.0.0
Identifier: Browser Error Platform: Web
Common Root Causes:
  • Service workers require HTTPS (or localhost) and cannot control paths outside their script directory.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Serve sw.js from the site root `/` with `text/javascript` over valid HTTPS.
Safe Diagnostic Command:
Check DevTools Application -> Service Workers
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Service workers require HTTPS (or localhost) and cannot control paths outside their script directory. Recommended diagnostic: `Check DevTools Application -> Service Workers`. Remediation: Serve sw.js from the site root `/` with `text/javascript` over valid HTTPS.

Worked Examples

  • Run `Check DevTools Application -> Service Workers` to confirm root cause before applying the fix.

Limitations & Assumptions

  • Always test configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-browser-service-worker-scope · Independently verified: 2026-11-25

Related Resources