fix(service-worker): use relative path for ngsw.json
Not every application is served from the domain root. The Service Worker made a bad assumption that it would be, and so requested /ngsw.json from the domain root. This change corrects this assumption, and requests ngsw.json without the leading slash. This causes the request to be interpreted relative to the SW origin, which will be the application root.
This commit is contained in:
@ -580,8 +580,8 @@ export class Driver implements Debuggable, UpdateSource {
|
||||
* Retrieve a copy of the latest manifest from the server.
|
||||
*/
|
||||
private async fetchLatestManifest(): Promise<Manifest> {
|
||||
const res = await this.safeFetch(
|
||||
this.adapter.newRequest('/ngsw.json?ngsw-cache-bust=' + Math.random()));
|
||||
const res =
|
||||
await this.safeFetch(this.adapter.newRequest('ngsw.json?ngsw-cache-bust=' + Math.random()));
|
||||
if (!res.ok) {
|
||||
if (res.status === 404) {
|
||||
await this.deleteAllCaches();
|
||||
|
Reference in New Issue
Block a user