feat(service-worker): support bypassing SW with specific header/query param (#30010)

Add support for bypassing the ServiceWorker for a request by using the
ngsw-bypass header or query parameter.

Fixes #21191

PR Close #30010
This commit is contained in:
Peter Johan Salomonsen
2019-04-25 22:51:10 +03:00
committed by Andrew Kushnir
parent 304a12f027
commit 6200732e23
6 changed files with 90 additions and 8 deletions

View File

@ -147,6 +147,15 @@ normally. However, occasionally a bugfix or feature in the Angular
service worker requires the invalidation of old caches. In this case,
the app will be refreshed transparently from the network.
### Bypassing the service worker
In some cases, you may want to bypass the service worker entirely and let the browser handle the
request instead. An example is when you rely on a feature that is currently not supported in service
workers (e.g.
[reporting progress on uploaded files](https://github.com/w3c/ServiceWorker/issues/1141)).
To bypass the service worker you can set `ngsw-bypass` as a request header, or as a query parameter.
(The value of the header or query parameter is ignored and can be empty or omitted.)
## Debugging the Angular service worker