-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
I'd like to use this to start a discussion based upon a topic I talked about with @gkalpak at ng-conf 2018.
As mentioned in #21288, the service worker implementation checkes the hashes of the cached files and if they don't match, it just serves the data from the network (which is like having no service worker).
The problem is that every proxy on the web can manipulate the files downloaded. This is especially the case for mobile providers that are minifying and inlining a lot of stuff on the fly to save bandwith. But also tools like live-server change the index.html (and so they can be used to reproduce this issue).
As one of the big use cases for PWAs are areas with low bandwith, this is somehow conflicting.
Perhaps one way to solve this is to provide an exchangeable HashCheckStrategy. In cases where I as the programmer wants to take the responsiblity for not checking the hashes in order to bypass this issue, I could write sth like this:
export class BruceWillisHashCheckStrategy implements HashCheckStrategy {
check(currentHash, expectedHash, fileName) {
return true;
}
}