#58406·angular

Service worker not updating after its response headers are updated

Author: siddiq-rehmanCreated Oct 29, 2024Updated Sep 16, 2026
Labelsarea: service-worker

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Hello,

I have came across a strange issue. I have a CSP policy setup done by the server through response headers. I also have a service worker running for the same page.

When I update the CSP in the server, its getting updated for the index.html, But the service-worker itself is not getting updated with the new CSP. The service worker is throwing CSP errors even tough the index.html and other assets got the CSP updated.

could you please give an way to re-load/update the service worker(ngsw-worker.js), when its own response headers are updated?

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.1.4 Node: 20.12.2 Package Manager: npm 10.8.2 OS: win32 x64

Angular: 17.1.2 ... animations, cdk, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, platform-server, router ... service-worker

Package Version

@angular-devkit/architect 0.1701.2 @angular-devkit/build-angular 17.1.2 @angular-devkit/core 17.1.2 @angular-devkit/schematics 17.1.2 @angular/cli 17.1.4 @schematics/angular 17.1.2 ng-packagr 17.1.2 rxjs 7.8.0 typescript 5.3.3 zone.js 0.14.3

Anything else?

No response