[ServiceWorker] passthrough service worker can break sites using redirected stylesheets (#757)

Consider a site `a.com` which has a stylesheet link to `a.com/foo.css`.  But `a.com/foo.css` redirects to `a.com/style/foo.css`.  Inside foo.css there is a relative background-image url to `./bg.jpg`.

With no service worker in play, the site will end up loading `a.com/style/bg.jpg`.

If there is a passthrough service worker that does nothing but `e.respondWith(fetch(e.request));` then the site will try to load `a.com/bg.jpg`.  This is because the redirect to `a.com/style/foo.css` is eaten by the SW fetch() call.

Should FetchEvent.request for stylesheet loads have RequestRedirect set to "manual"?  This would ensure that the stylesheet always sees the final URL and properly loads the correct relative sub-resources.

cc @jakearchibald @slightlyoff @annevk 

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/757

Received on Friday, 2 October 2015 14:58:32 UTC