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
Audio/Video element with preload can lead to precaching getting a 206 response and crashing #3288
Comments
Hmm, actually I probably need to add the RangeRequests plugin to the precaching handler... So that runtimeCachine example from the linked article isn't helpful for that... |
Doesn't seem to help even if I do that though... |
I guess a workaround will be to do I guess a fix will be to just let such requests through to the network, without trying to precache from their response, letting the normal pre-caching still take place, or alternatively to outright to dump the |
Maybe we want something like this in the range requests plugin or inside
|
Doesn't work. The |
We probably need to add 206 to be ignored here:
|
Doesn't help, still leads to |
So basically the browser sets a async cacheWillUpdate({ response }) {
// The default will update logic of workbox-precaching
if (!response || response.status >= 400) {
return null;
}
if (response.status === 206 /* && fullBody */) {
console.log('Patching 206 response');
response = await copyResponse(response, (responseInit) => {
responseInit.status = 200;
return responseInit;
})
}
return response;
}, But I think |
Library Affected:
workbox-precaching
Browser & Platform:
Google Chrome 120.0.6099.199 Desktop
Issue or Feature Request Description:
On a page with an audio/video elements with
preload="auto"
, where workbox is also set to precache the audio/video src file, sometimes the service worker ends up getting a 206 in its install event for its precache request, which leads to the following error:I'd assume it's taking the request to preload from the browser which has a
Range
request, before the pre-caching is done, and sending it to the network, trying to pre-cache based on it, instead of simply dropping the uncachable partial response, and still sending a normal pre-cache request separately.I did follow https://developer.chrome.com/docs/workbox/serving-cached-audio-and-video (P.S. I guess the
cacheableResponse
plugin for this is redundant nowadays?)When reporting bugs, please include relevant JavaScript Console logs and links to public URLs at which the issue could be reproduced.
The site is private, I will create a standalone repro later on.
The text was updated successfully, but these errors were encountered: