Skip to content
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

Cache mode: fromCache #40

Open
annevk opened this issue Apr 5, 2015 · 10 comments
Open

Cache mode: fromCache #40

annevk opened this issue Apr 5, 2015 · 10 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: api

Comments

@annevk
Copy link
Member

annevk commented Apr 5, 2015

We want to introduce fromCache member on Response objects. However, this in part depends on how we tackle #38 and also #39 of course. If a Response is partially formed from a cached entry, should it say "partial"?

@annevk
Copy link
Member Author

annevk commented Nov 6, 2015

Given that the use case for this is w3c/ServiceWorker#412 (comment) which is somewhat obscure, I'm not planning on addressing this for now.

@annevk annevk added the later label Nov 6, 2015
@kanongil
Copy link

I don't think that the linked use case is all that valid regarding this feature. I'd say this #39 (comment) is much more applicable.

Determining whether a resource comes from the cache is an important part of the bandwidth estimation that must be handled when serving adaptive bitrate video content. The fromCache attribute would enable more accurate estimation. Currently, this can only be approximated using response timing information.

@annevk
Copy link
Member Author

annevk commented Nov 24, 2015

Yes, but from that issue we also know that only-if-cached is not acceptable for security reasons and this would expose exactly that. And if we limit this to same-origin it would not at all be interesting for video content.

@annevk
Copy link
Member Author

annevk commented Nov 24, 2015

Perhaps it's best to remove the "cache state" concept from the specification for now until we find a way to address these issues.

@kanongil
Copy link

Hmm... Given that the security concerns would be largely circumvented if the server allows the client to sends If-Modified-Since, If-None-Match, etc, it might be possible to use this to enable this feature for such CORS requests?

Of course this would require a CORS pre-flight request to discover, which means that the fromCache attribute would require a special mode / flag to enable on a request.

@mnot
Copy link
Member

mnot commented Nov 25, 2015

FWIW - I think this is a bit different than only-if-cached. The problem there is that it makes it possible to probe the cache without any corresponding traffic being emitted to the server, making it a passive attack.

Exposing fromCache doesn't do that; if someone tries to use it for probing, it will still emit traffic.

What it does do is slightly improve confidence as opposed to cache timing attacks (but they're pretty conclusive anyway, AIUI).

@ParkFramework
Copy link

Maybe, within server respons headers Cache-Control: stale-*, to solve this problem?
RFC5861
https://tools.ietf.org/rfc/rfc5861.txt

@annevk
Copy link
Member Author

annevk commented Nov 25, 2015

@mikewest what do you think with regards to @mnot analysis?

@annevk annevk added the addition/proposal New features or enhancements label Jan 7, 2016
@annevk annevk added needs implementer interest Moving the issue forward requires implementers to express interest and removed later labels May 4, 2016
@annevk annevk closed this as completed in 8d343bb Jul 22, 2016
@annevk
Copy link
Member Author

annevk commented May 7, 2021

As Resource Timing exposes some this information, it's reasonable to consider exposing it directly on Response objects again for convenience.

@annevk
Copy link
Member Author

annevk commented May 16, 2022

A complementary API to this might be a more explicit opt-in for surfacing 304 responses to the caller, saving the browser from obtaining the full response from the cache. (This is already possible if the caller sets certain headers themselves, but perhaps that ought to have a more abstract entry point as well.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: api
Development

No branches or pull requests

4 participants