Skip to content

Commit 6786f4f

Browse files
committed
Fix service worker not loading
I removed this under the impression the default was to allow it anywhere but that's not the case. Since the service worker was already registered in my browser I never got the error during testing.
1 parent 2a3608d commit 6786f4f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/node/routes/static.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ router.get("/(:commit)(/*)?", async (req, res) => {
3232
res.header("Cache-Control", "public, max-age=31536000")
3333
}
3434

35+
// Without this the default is to use the directory the script loaded from.
36+
if (req.headers["service-worker"]) {
37+
res.header("service-worker-allowed", "/")
38+
}
39+
3540
/**
3641
* Used by VS Code to load extensions into the web worker.
3742
*/

0 commit comments

Comments
 (0)