I want to cache assets from a secure CDN that uses policy token as URL params.
for example: www.cdn.com/image.png?Policy=AAAAA&Key-Pair-Id=BBBBB
and if I re-visit the site, I want to get the asset from the cache even if I have a different policy token and Key-Pair-Id.
for example: www.cdn.com/image.png?Policy=CCCCC&Key-Pair-Id=DDDDD
If I use this code in the service worker:
workbox.routing.registerRoute(
/^(http(s)?:)?\/\/www\.cdn\.com.*/,
workbox.strategies.staleWhileRevalidate()
);
It doesn't find the response in the cache and goes to the network.
I want it to match by the URL without the URL params (even if Policy=CCCCC&Key-Pair-Id=DDDDD is not actually a valid policy). just look if www.cdn.com/image.png exists and retrieve it.