Closed johnelliott closed 5 years ago
Hmm, based on this it should already exclude any URLs with extensions:
Hmm is that for the white list or black list?
I may be misunderstanding, but using regex101.com I didn't see .mp3
matching either of the regular expressions that the plugin has for the whitelist or the blacklist. Perhaps I am not trying a proper URL string.
Yes that's the point. The service worker should ONLY cache URLs that match the navigateFallbackWhitelist
, unless it also matches navigateFallbackBlacklist
. some-file.mp3
doesn't match the whitelist, so the worker shouldn't even consider caching it.
Edit: To clarify, these are options for workbox-build
.
Could you put up some demo code where this behavior can be reproduced?
Thank you. I did see where the options went, I just read the effects backward. I think I will just close this. Iām just glad folks can now search this in closed issues if the question arises for others.
I'm not sure if this should be closed yet: If the whitelist regex doesn't match your media URLs, then why is the service worker intercepting them? Maybe I am just misunderstanding you, does it work now without ?nocache=1
?
Summary
My first issue š
Add media file regex to plugin-offline workbox
navigateFallbackBlacklist
list.Basic example
Motivation
I was experiencing some audio player slowness and saw that the service worker appeared to be intercepting requests for my mp3 files from an HTML5 audio tag. This appeared to be preventing HTTP 1.1 range requests and I saw my file loading all at once. This was in Safari 12.
cURL confirmed that my host (firebase) could handle the range requests and send back HTTP 206 status codes.
I added ?nocache=1 to my HTML5 audio tag URLs and saw that I was getting successful range requests. This appears to be a way around the service worker issue.
Adjusting the default for common file types could help others and provide a better out-of-the-box experience. Alternate solutions could be adding to documentation or doing nothing.