Glossary

Service worker scope

The URL prefix a registered service worker controls. By default the scope equals the path the worker file is served from; the Service-Worker-Allowed header can broaden it.

A worker at /sw.js defaults to scope /. A worker at /build/sw.js defaults to scope /build/ and only intercepts requests under that prefix. To register a worker outside the file’s directory, the server returns Service-Worker-Allowed: / and the registration call passes { scope: '/' }. Multiple workers may register on a single origin, but only one can be the active controller for any given scope.