Service Worker Data Cached but Returns 504 When offline

Viewed 34

My Angular applications static js files are in a nginx server which is hosted in a docker container. Installability works fine, and the data responses from the API requests are in the cached storage. When online - the API requests return 200 (from service worker) as below. But when request is made to same api when offline it returns 504 (from Service Worker).

504 when offline

{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [{
    "name": "app",
    "installMode": "prefetch",
    "resources": {
        "files": [
            "/favicon.ico",
            "/index.html",
            "/manifest.webmanifest",
            "/*.css",
            "/*.js"
        ]
    }
}, {
    "name": "assets",
    "installMode": "lazy",
    "updateMode": "lazy",
    "resources": {
        "files": [
            "/assets/**",
            "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
    }
}],
"dataGroups": [{
    "name": "my-api",
    "urls": [
        "/**/MyService.svc*"
    ],
    "cacheConfig": {
        "strategy": "freshness",
        "maxSize": 1000,
        "maxAge": "7d",
        "timeout": "5s"
    }
}] }

I assume the path restrictions are correct as when i test using http server locally it works fine.

0 Answers
Related