Bug 190041
Summary: | Safari refuses to open pages with workbox due to “service worker redirection error”. | ||
---|---|---|---|
Product: | WebKit | Reporter: | srikarocks |
Component: | Service Workers | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | mathias, tomac, webkit-bug-importer, webkit, youennf, zev.goldstein |
Priority: | P2 | Keywords: | InRadar |
Version: | Other | ||
Hardware: | iPhone / iPad | ||
OS: | Other |
srikarocks
I was using iOS 12 which is not available as an option currently.
On websites which use workbox for service workers cannot be opened due to an error titled “Response served by service worker has redirections”. I first ran into this error on https://v8.dev which uses workbox. The v8 team, which wrote the website, confirmed on GitHub https://github.com/v8/v8.dev/issues/4 that no redirects are used on the homepage.
More details about this issue are on https://github.com/v8/v8.dev/issues/4
Instructions to reproduce:
Turn on service workers: Settings>Safari>Advanced>Experimental Features>ServiceWorker>ON.
1. Visit a workbox site (https://v8.dev) and bookmark the site
2. Close the tab and then close the browser
3. Reopen safari and open the bookmark. If the error doesn’t appear, repeat this step.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/44878311>
youenn fablet
I reproduced the issue on iOS.
It might be that we are incorrectly computing that the response is redirected, maybe we are not handling 304 correctly
youenn fablet
Doing some debugging the following is happening:
- A navigate load triggers a fetch event to "https://v8.dev"
- The service worker fetches "https://v8.dev/index.html"
- "https://v8.dev/index.html" is redirected to "https://v8.dev" which gives a response
- response.redirected is set to true since there is a redirection.
- Navigation load fails since it does not expect a redirected response as per spec.
I guess the fix should be for the service worker to directly fetch "https://v8.dev".
Mathias Bynens
Thanks for the info, Youenn! I’ll get the service worker fixed on our end.
FWIW, this behavior does not match Chrome‘s, where the bug does not appear. Maybe there is still some kind of browser-compat bug here.
youenn fablet
> FWIW, this behavior does not match Chrome‘s, where the bug does not appear.
> Maybe there is still some kind of browser-compat bug here.
It seems so if the scripts are the same in iOS and elsewhere.
Safari MacOS works, not iOS.
On MacOS, index.html fetch event is answered by the DOM cache.
On iOS, index.html is not in the DOM cache, fetch is used and it fails.
youenn fablet
(In reply to youenn fablet from comment #5)
> > FWIW, this behavior does not match Chrome‘s, where the bug does not appear.
> > Maybe there is still some kind of browser-compat bug here.
>
> It seems so if the scripts are the same in iOS and elsewhere.
> Safari MacOS works, not iOS.
I hit this issue in MacOS as well.
> On MacOS, index.html fetch event is answered by the DOM cache.
> On iOS, index.html is not in the DOM cache, fetch is used and it fails.
When hitting this issue in MacOS, the DOM cache is also empty.
youenn fablet
Marking as resolved for now.