angular-cn/packages/service-worker
George Kalpakas 08325aaffc feat(service-worker): add support for configuring navigations URLs (#23339)
The ServiceWorker will redirect navigation requests that don't match any
`asset` or `data` group to the specified index file. The rules for a
request to be classified as a navigation request are as follows:
1. Its `mode` must be `navigation`.
2. It must accept a `text/html` response.
3. Its URL must match certain criteria (see below).

By default, a navigation request can have any URL except for:
1. URLs containing `__`.
2. URLs to files (i.e. containing a file extension in the last path
   segment).

While these rules are fine in many cases, sometimes it is desirable to
configure different rules for the URLs of navigation requests (e.g.
ignore specific URLs and pass them through to the server).

This commit adds support for specifying an optional `navigationUrls`
list in `ngsw-config.json`, which contains URLs or simple globs
(currently only recognizing `!`, `*` and `**`).
Only requests whose URLs match any of the positive URLs/patterns and
none of the negative ones (i.e. URLs/patterns starting with `!`) will be
considered navigation requests (and handled accordingly by the SW).

(This is an alternative implementation to #23025.)

Fixes #20404

PR Close #23339
2018-04-13 13:13:36 -07:00
..
cli build(service-worker): properly build npm_package with Bazel (#23090) 2018-04-04 10:26:38 -07:00
config feat(service-worker): add support for configuring navigations URLs (#23339) 2018-04-13 13:13:36 -07:00
src feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573) 2018-03-19 21:51:51 -07:00
test feat(service-worker): add support for configuring navigations URLs (#23339) 2018-04-13 13:13:36 -07:00
testing feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573) 2018-03-19 21:51:51 -07:00
worker feat(service-worker): add support for configuring navigations URLs (#23339) 2018-04-13 13:13:36 -07:00
BUILD.bazel build(service-worker): properly build npm_package with Bazel (#23090) 2018-04-04 10:26:38 -07:00
build.sh feat(service-worker): add helper script which will uninstall SW (#21863) 2018-01-30 11:43:03 -08:00
index.ts fix(aio): add service worker entrypoint to aio build (#19875) 2017-10-23 19:31:42 -04:00
package.json feat: update the package output of build.sh to APF v6 (#22808) 2018-03-18 09:33:51 -07:00
public_api.ts feat(service-worker): introduce the @angular/service-worker package (#19274) 2017-09-28 16:18:12 -07:00
rollup.config.js feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573) 2018-03-19 21:51:51 -07:00
safety-worker.js feat(service-worker): add helper script which will uninstall SW (#21863) 2018-01-30 11:43:03 -08:00
tsconfig-build.json fix(service-worker): ensure initialised in browser only (#20782) 2017-12-06 06:55:33 -08:00