angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

bug(ServiceWorker): multiple apps with ServiceWorker on one domain

Open skydever opened this issue 8 years ago • 2 comments

Versions

Angular CLI: 1.6.0
Node: 8.9.4
OS: linux x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

Repro steps

see issue #21388 from the angular repository.

Observed behavior

multiple apps with service worker break when hosted on one origin/domain (different baseHref). the CacheDatabase keys are the same and one app will overwrite the entries from another app.

Desired behavior

The CacheDatabase should not be able to modify entries from another app when hosted on the same origin/domain.

Mention any other details that might be useful (optional)

I found this line of code, where the ngsw-worker.js will be read and afterwards written to the build folder. Just replacing ngsw:db with ngsw:db:${baseHref} for this kind of entries in workerCode would do the job (tried it out by manually modifying ngsw-worker.js after the build process). What is the best way to handle that (string replacement would fail fast I guess, or maybe not)? The service worker does not know what the baseHref will be, so I created this issue here too. Would like to help.

skydever avatar Jan 17 '18 22:01 skydever

Ths is a bug with ServiceWorker directly, so I'll close this in favor of angular/angular#21388

hansl avatar Jan 24 '18 18:01 hansl

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.