Re: [w3c/ServiceWorker] Allow overlapping scopes (#1085)

We'd like a request to `/foo/cat.jpg` from a page open at `/` to be served by the SW at `/foo/`, and anything else served by the SW at `/`. I thought this is already how it works as @delapuente described - it already goes to the longest scope it can, right?

Our use case is actually live now, at editor.construct.net. The pattern we've settled on after a few false starts is:

`editor.construct.net/` - serves latest version
`editor.construct.net/r1/` - first version
`editor.construct.net/r2/` - second version, etc.

The `/` path serves an index.html with a base href pointing at the latest version, e.g. `r2/`. There is a SW at `r2/sw.js` which caches version 2 for offline use.

There's just the problem of serving the file at `editor.construct.net/index.html` while offline - so we put another SW at `editor.construct.net/sw.js` designed to cache only index.html (and a couple of other files we happen to need at that level). So then:
`/sw.js` servers root-level files
`/r2/sw.js` serves that version of the web app

As I say it's live so these URLs should all work and you can check it out. As far as I can tell it works, so I think our use case is covered already... unless it only works by accident?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1085#issuecomment-290377454

Received on Thursday, 30 March 2017 11:00:19 UTC