ng service-worker does not cache data
See original GitHub issueng service-worker caches data only for the time specified in the Cache-Control response header: public, max-age = 60, s-maxage = 60. After 60 seconds in offline mode, the response 504 Gateway Timeout (from ServiceWorker) comes to the request.
{
"$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": "prefetch",
"resources": {
"files": [
"/assets/**",
"/app/app.component.ts",
"/*.(pdf|odt|eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
],
"dataGroups": [
{
"name": "github-api",
"urls": ["**//api.github.com/**"],
"cacheConfig": {
"strategy": "performance",
"maxSize": "100",
"maxAge": "7d"
}
}
]
}
What could be the problem?
P.S. I installed the worker for my application using this command: ng add @angular/pwa --project project-name –
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Angular service worker doesn't cache assets once deployed ...
Even though the scope path seems being correct and the app is installable, the service worker does not caches the assets nor the...
Read more >Angular PWA service worker doesn't cache every resource ...
It looks like what is happening is that, on first load, the browser is getting the core assets and putting them in the...
Read more >Service worker configuration - Angular
Does not cache any of the resources up front. Instead, the Angular service worker only caches resources for which it receives requests. This...
Read more >Caching HTTP Requests in Angular using Service Workers
This json currently has no configuration for caching http requests. It needs to be noted that only non-mutating http requests like GET and...
Read more >Angular Service Worker - Step-By-Step Guide
This is a Javascript-based key/value caching mechanism that is not related to the standard browser Cache-Control mechanism, and the two ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks so much for the consultation! (‘ngsw-bypass’, ‘true’) is exactly what I need!
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.