i'm using workbox-sw to cache some API requests and I'm wondering if it is possible to add custom header to responses that were returned from the cache.
my sw.js looks like this:
importScripts('workbox-sw.prod.v2.1.1.js');
const workboxSW = new WorkboxSW();
workboxSW.precache([]);
workboxSW.router.registerRoute(
new RegExp('^https://api\.url/'),
workboxSW.strategies.cacheFirst({
cacheName: 'api-cache',
cacheExpiration: {
maxEntries: 10,
maxAgeSeconds: 3600 * 24
},
cacheableResponse: {statuses: [200]}
})
);
Any idea how to add a header to response?
Thanks!