mirror of https://github.com/coder/code-server.git
Fix service worker not loading (#2335)
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.
This commit is contained in:
parent
08b9e9ad1f
commit
72caafe8b0
|
@ -52,6 +52,11 @@ router.get("/(:commit)(/*)?", async (req, res) => {
|
|||
res.header("Cache-Control", "public, max-age=31536000")
|
||||
}
|
||||
|
||||
// Without this the default is to use the directory the script loaded from.
|
||||
if (req.headers["service-worker"]) {
|
||||
res.header("service-worker-allowed", "/")
|
||||
}
|
||||
|
||||
res.set("Content-Type", getMediaMime(resourcePath))
|
||||
|
||||
if (resourcePath.endsWith("manifest.json")) {
|
||||
|
|
Loading…
Reference in New Issue