import { FreshContext } from '$fresh/server.ts' export async function handler(request: Request, ctx: FreshContext) { // Allow service worker to serve root scope const response = await ctx.next() const url = new URL(request.url) if (url.pathname.endsWith('island-startserviceworker.js')) { response.headers.set('Service-Worker-Allowed', '/') } return response }