- From: Yoav Weiss <notifications@github.com>
- Date: Fri, 24 Jan 2025 03:46:13 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1690/2612333273@github.com>
Thanks for filing this! I have an extremely similar use case, where I need to be able to exclude certain paths from being handled by the service worker. When chatting through this on [Chromium's worker-dev](https://groups.google.com/a/chromium.org/g/worker-dev/c/G4vTpgbCq5Y/m/UIlZYyu_CAAJ?utm_medium=email&utm_source=footer) it was mentioned that the [static routing API](https://github.com/WICG/service-worker-static-routing-api) can handle this use case. They do not address my use case for the following reasons: ## Specificity It's not immediately obvious to me what happens with ```javascript addEventListener('install', (event) => { event.addRoutes({ condition: { urlPattern: new URLPattern({pathname: "/.well-known/*"}) }, source: "network" }); } addEventListener('install', (event) => { event.addRoutes({ condition: { urlPattern: new URLPattern({pathname: "/.well-known/secret/*"}) }, source: "fetch-event" }); } ``` Would the route added in the second event be ignored? ## Subresource requests My use case is about excluding the environment from the SW scope, not just the request itself. https://github.com/WICG/service-worker-static-routing-api/issues/7 discusses this, but it seems like a separate primitive to enable this would be simpler. ## Deployability Having to programmatically call `addRoute` from the SW's install event adds a lot of complexity for a platform provider that wants to enable developers to install limited service workers on their origin. A header is significantly easier to deploy. /cc @yoshisatoyanagisawa @sisidovski @domenic -- Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1690#issuecomment-2612333273 You are receiving this because you are subscribed to this thread. Message ID: <w3c/ServiceWorker/issues/1690/2612333273@github.com>
Received on Friday, 24 January 2025 11:46:17 UTC