- From: Jake Archibald <notifications@github.com>
- Date: Mon, 08 Jun 2015 02:48:27 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/706/109934953@github.com>
> The SW does `event.respondsWith(new Response(302))` I assume you mean: `event.respondWith(Response.redirect(url))`? In this case the fetch algorithm receives the redirect response, and (as @jungkees says) because the request's "redirect mode" flag is not "follow", the redirect response is passed back to the navigation algorithm. `url` will be loaded as a navigation, using the ServiceWorker associated with the destination `url`, if any. The url in the location bar will be the final destination url. > The SW does `event.respondWith(fetch('url-that-redirects'))` In this case, `fetch()` will swallow the redirects, so you'll end up with a non-3xx response. That response is passed back to the page's invocation of the fetch algorithm. If it was a client request, and the response was not "basic" or "default" (eg, if it was from another origin), it will be treated as a network error. Otherwise, the page will load the response as if it came from the origin request url, and it will be controlled by the SW that provided the response, the url in the location bar will not change. > The SW does nothing, the server responds with HTTP 302 The navigation algorithm will receive the redirect response and issue a new fetch for the destination url, using the ServiceWorker associated with the destination url, if any. The url in the location bar will be updated to reflect the destination url. I'm pretty sure the spec is ok here. --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/706#issuecomment-109934953
Received on Monday, 8 June 2015 09:49:00 UTC