Skip to content

Caching in service worker isn't working when path is generalized. #48714

@ChayanNath

Description

@ChayanNath

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

service-worker

Is this a regression?

Yes

Description

When I'm configuring my dataGroups for caching in ngsw-config.json, if I specify the full path, only then the caching works. Otherwise, It doesn't cache.

This works:
"dataGroups": [{ "name": "getRequestCache", "urls": [ "myapp/ai_models", "myapp/ai_models/parameters" ], "cacheConfig": { "strategy": "freshness", "maxSize": 1000, "maxAge": "3d", "timeout": "10s" } } ]

This doesn't work:
"dataGroups": [{ "name": "getRequestCache", "urls": [ "/**", "/**/**", "/**/**/**" ], "cacheConfig": { "strategy": "freshness", "maxSize": 1000, "maxAge": "3d", "timeout": "10s" } } ]

Is there any way to not write each path specifically and assign a general path, so that everything gets cached?

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)

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: service-workerIssues related to the @angular/service-worker package

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions