Fix caching behaviour of service worker

This commit is contained in:
pietervdvn 2022-07-12 14:21:14 +02:00
parent a7b0db2416
commit d50b60f07a

View file

@ -71,7 +71,7 @@ self.addEventListener('fetch',
event.respondWith(new Response(JSON.stringify({"service-worker-version": version}))); event.respondWith(new Response(JSON.stringify({"service-worker-version": version})));
return return
} }
const shouldBeCached = origin.host === requestUrl.host && origin.host !== "127.0.0.1:1234" && origin.host !== "localhost" && !origin.host.endsWith(".gitpod.io") const shouldBeCached = origin.host === requestUrl.host && origin.hostname !== "127.0.0.1" && origin.hostname !== "localhost" && !origin.host.endsWith(".gitpod.io")
if (!shouldBeCached) { if (!shouldBeCached) {
console.log("Not intercepting ", requestUrl.toString(), origin.host, requestUrl.host) console.log("Not intercepting ", requestUrl.toString(), origin.host, requestUrl.host)
// We return _without_ calling event.respondWith, which signals the browser that it'll have to handle it himself // We return _without_ calling event.respondWith, which signals the browser that it'll have to handle it himself