Skip to content

Commit b41f6c7

Browse files
committed
Add comment on Service-Worker-Allowed header
1 parent 899304e commit b41f6c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/node/routes/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
130130
cacheControl: commit !== "development",
131131
fallthrough: false,
132132
setHeaders: (res, path, stat) => {
133+
// The service worker is served from a sub-path on the static route so
134+
// this is required to allow it to register a higher scope (by default
135+
// the browser only allows it to register from its own path or lower).
133136
if (path.endsWith("/serviceWorker.js")) {
134137
res.setHeader("Service-Worker-Allowed", "/")
135138
}

0 commit comments

Comments
 (0)