using /workbox-cdn/releases/4.3.0/workbox-sw.js
i am returning header(X-Is-Cacheable: yes) in response to my api call.
below is my custom service code.
workbox.routing.registerRoute(
/http:\/\/127\.0\.0\.1\/lumen/,
new workbox.strategies.CacheFirst({
cacheName: 'api-cache',
plugins: [
new workbox.cacheableResponse.Plugin({
statuses: [200],
headers: {
'X-Is-Cacheable': 'yes',
},
})
]
}),
'GET'
)
Issue is that 'api-cache' is being created for headers (X-Is-Cacheable: no) and also there is no response data being save for responses having (X-Is-Cacheable: yes) header.
It looks like you're making a CORS request to the third-party origin http://127.0.0.1/. Because you're using CORS, there are limits on the headers that are exposed on your Response objects by default.
You can override those limits by explicitly adding a Access-Control-Expose-Headers: X-Is-Cacheable header to your server-generated response, along with the X-Is-Cacheable: yes header.
You can read more about how this works at https://fetch.spec.whatwg.org/#http-access-control-expose-headers
Most helpful comment
It looks like you're making a CORS request to the third-party origin
http://127.0.0.1/. Because you're using CORS, there are limits on the headers that are exposed on yourResponseobjects by default.You can override those limits by explicitly adding a
Access-Control-Expose-Headers: X-Is-Cacheableheader to your server-generated response, along with theX-Is-Cacheable: yesheader.You can read more about how this works at https://fetch.spec.whatwg.org/#http-access-control-expose-headers