Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

url hashes count as cache misses #290

Closed
whmountains opened this issue May 2, 2017 · 4 comments
Closed

url hashes count as cache misses #290

whmountains opened this issue May 2, 2017 · 4 comments

Comments

@whmountains
Copy link

Like the title says. example.com works, but example.com#chapter2 counts as a cache miss and the page fails to load.

Is this a bug, or the intended behavior. If it's intended, can we add a configuration option to strip hashes? It could be done inside the stripIgnoredUrlParameters function.

@whmountains
Copy link
Author

Update: I tested in Chrome and it works fine with hashes, so the behavior seems to be Firefox only.

I did some debugging and I think I've found the root of the problem. event.request.url does not include the hash segment in Chrome but in Firefox it does, hence the cache misses.

This may be a bug in Firefox, Chrome, or just an ambiguity in the spec, but in any case it would be an easy fix to work around it in the service worker code.

@jeffposnick
Copy link
Contributor

Thanks for pointing this out—it's due to w3c/ServiceWorker#854.

That new behavior shipped in Firefox 52, and will ship in the upcoming Chrome 59 beta as well. I'll take care of adjusting the sw-precache logic to account for it.

@whmountains
Copy link
Author

Thank you!

Will you publish a bugfix version immediately, or will I have to install directly from git until the next release comes out?

@jeffposnick
Copy link
Contributor

I don't anticipate much of a delay in releasing this as 5.1.1 once the PR is merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants