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

Make it more clear that cache mode "default" does respect Cache-Control headers and such #336

Closed
annevk opened this issue Jul 20, 2016 · 5 comments

Comments

@annevk
Copy link
Member

annevk commented Jul 20, 2016

Basically, when you go to the HTTP cache with a request whose cache mode is "default", and the request also has Cache-Control or Pragma headers, those need to be respected by the HTTP cache, just as they always were.

Alternatively we could make those headers and their values change the cache mode:

  • If the cache mode is “default” and a Cache-Control or Pragma Header is present, whose value is “no-cache”, then set the cache mode from “Default” to no-cache.
  • If the cache mode is “default” and a Cache-Control or Pragma Header is present, whose value is “no-store”, then change the cache mode from “Default” to no-store.

That's not observable so either approach is probably fine. Thoughts anyone?

@ehsan
Copy link

ehsan commented Jul 20, 2016

Hmm, wouldn't this be observable through a service worker script which intercepts the original fetch and looks at the Request.cache field?

@annevk
Copy link
Member Author

annevk commented Jul 21, 2016

I thought so too, but where we modify it today is way later. Basically just before asking the HTTP cache. Which seems fairly sensible.

@annevk
Copy link
Member Author

annevk commented Jul 21, 2016

However, it's probably better to not special case headers and header values since we might introduce new headers and header values and "default" should remain working the same way. The current switch from "default" to something else is largely a legacy thing.

@wanderview
Copy link
Member

Can't the service worker just inspect the headers anyway? Why are we worried about it observing it?

@annevk
Copy link
Member Author

annevk commented Jul 21, 2016

I think we're only worried to the extent that it would affect existing implementations.

annevk added a commit that referenced this issue Jul 22, 2016
If the cache mode is “default” and you set a Cache-Control header, that
should be taken into account when talking to the HTTP cache subsystem.
It’s how the cache works by “default”, after all.

Fixes #336.
@mnot mnot mentioned this issue Mar 1, 2017
@annevk annevk closed this as completed in cbca2c2 Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants