Angular Service Worker - Resource failed to load: server responded to status 504 (Gateway Timeout)

I am using Angular -CLI 1.6.6 and @ angular / service-worker 5.2.5 in our Angular 5.2.5 application. Everything works fine on the local Lite server, as well as on the production server, with the exception of one error message that appears in our production environment:

Failed to load resource: the server responded with a status of 504 (Gateway Timeout)

Looking in the ngsw-worker.js script, I found the line (2466) where the error message is generated:

async safeFetch(req) {
    try {
        return await this.scope.fetch(req);
    }
    catch (err) {
        this.debugger.log(err, `Driver.fetch(${req.url})`);
        return this.adapter.newResponse(null, {
            status: 504,
            statusText: 'Gateway Timeout',
        });
    }
} 

An error logging to the console in the catch log produces the following error:

TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode
    at Driver.safeFetch (ngsw-worker.js:2464)
    at Driver.handleFetch (ngsw-worker.js:1954)
    at <anonymous>

The error, which is apparently related to this question: What causes the "fetch" in the "ServiceWorkerGlobalScope" to fail: "only-if-cached" can only be set with the "identical" -origin 'mode error?

Req, , - :

https://example.com/test/#/connect
https://example.com/test/#/map?token=[accestoken]
...

.

- ? safeFetch() (, HashLocationStrategy)? - ?

+38
1

ETag .

0

All Articles