From d50b60f07a1cd7de2ed09c0d06ea3b91df32e42b Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 14:21:14 +0200 Subject: [PATCH] Fix caching behaviour of service worker --- service-worker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-worker.ts b/service-worker.ts index 56e006a4e..d50009104 100644 --- a/service-worker.ts +++ b/service-worker.ts @@ -71,7 +71,7 @@ self.addEventListener('fetch', event.respondWith(new Response(JSON.stringify({"service-worker-version": version}))); 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) { 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