-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect Service Worker Error #4
Comments
Thanks for filing this. This sounds like a Safari bug… I’ll try to get my hands on an iOS device and run some tests. |
FWIW, there is some special logic in Workbox to deal with redirected responses due to security restrictions in the service worker specification. |
I’m closing the issue for now assuming this is a safari bug. If this is not a safari bug feel free to reopen this issue. |
I agree it does smell like a Safari bug. Would you mind reporting this to Apple? https://bugs.webkit.org/ |
@jeffposnick so I’m assuming it’s a general bug for any site that uses workbox? Or is there anything more specific that only affects v8 et al? |
Sorry, I'm not implying that this is a bug for any site that uses Workbox. I'm also not sure what kind of redirects, if any, actually happen with https://v8.dev. I just wanted to point out that there is some special considerations around redirects which Workbox attempts to account for. |
Just browsing the website, you wouldn’t run into any redirects on https://v8.dev/. (We have some redirects set up, but we don’t link to them anywhere.) |
Definitely a safari bug which affects workbox sites then. |
Issue has been filed https://bugs.webkit.org/show_bug.cgi?id=190041 |
Thank you, @realsrikar! |
I did some debugging and put some information in The service worker is fetching "https://v8.dev/index.html" which redirects to "https://v8.dev". |
@jeffposnick How can we prevent this in Workbox? Instead of
|
Probably would use index.html |
I had a second look and I think there is a bug in Safari which prevents index.html to be served from cache. This then triggers the bug from workbox. |
For what it's worth, I just tried Workbox 3.6.3 and it did not fix this issue (which implies to me that GoogleChrome/workbox#1677 and this issue) are not one in the same. For Workbox users looking for a solution to this iOS/Workbox bug, adding workboxBuild.generateSW({
// make sure that index.html is not matched by your globPatterns
globPatterns: ['**\/*.{js,css,png}'],
templatedUrls: {
// '.' must be used instead of '/' in my case because my app is not served from the
// root of the domain (but rather, from a subdirectory); using '.' will work
// in either case
'.': ['index.html']
}
}); |
@caleb531 +1 This solved the issue for us too, although in our case we could use |
For someone not using the Webpack plugin, where does the templatedurls code go? I just have a regular workbox install. |
@datapolitical I built my project with Gulp, so I put my templatedUrls code in my gulpfile.js as part of a gulp task that was using |
So I'm using Jekyll, with this plugin: https://github.com/bmeurer/jekyll-workbox-plugin. I've read all the relevant files and it doesn't seem like there's an obvious place to put that templatedurls code. But I'm also not that familiar with Workbox. If you have any ideas how to update service-worker.js or sw.js or change the plugin to include or get the same result as the templatedurls I'd be very, very appreciative. :-) |
Introduction
iOS 12 Safari shows an error saying “response server by service worker has redirections” and refuses to open the page. This happens after the service worker has been installed i.e. after the first couple visits.
Error
How to Reproduce
Edit
I forgot to mention that I had ServiceWorkers enabled which is an experimental option in safari. So this is likely a safari bug. To turn on service workers: Settings>Safari>Advanced>Experimental Features>ServiceWorker>ON.
The text was updated successfully, but these errors were encountered: