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

BCP56bis: more Cache-Control directive practice #1380

Closed
Jxck opened this issue Jan 19, 2021 · 1 comment
Closed

BCP56bis: more Cache-Control directive practice #1380

Jxck opened this issue Jan 19, 2021 · 1 comment
Labels

Comments

@Jxck
Copy link

Jxck commented Jan 19, 2021

Cache-Control header seems a one of confusing point for developer.

for example, as @mnot noted in Cache-Control in the wild | Fastly there are a lot of strange directive combination which says much developer doesn't understand Cache-Control correctly.

So I hope BCP include more important practice around caching.

private / public

mentioning about adding private for private content which must not be stored in shared cache.
and public is not a thing for public content because caches are public by default.

explicit cache-control for heuristic cache

no Cache-Control header doesn't mean un-cacheable. browser could cache them under heuristic caching theory.
so if you have any restriction around caching, adding cache-control header for explicit control.

see also Twitter Direct Message Caching and Firefox - Mozilla Hacks - the Web developer blog

no-cache is not a "don't cache"

already mentioned is draft

max-age=0 + must-revalidate

it's better to use no-cache (almost same bihavior)

Cache-Control: max-age=0, must-revalidate # 👎
Cache-Control: no-store # 👍

s-maxage & proxy-revalidate

s-maxage & proxy-revalidate are optional when you do different control for shared proxy. so
if max-age and s-maxage has same value, s-maxage is ommitable.
if must-revalidate is present, proxy-revalidate is ommitable.

Cache-Control: max-age=100, s-maxage=100, must-revalidate, proxy-revaliate 👎
Cache-Control: max-age=100, must-revalidate 👍

throw the kitchen sink

if you really wanna make this not cacheable and avoid store any cache, best choice is to use no-store alone.

Cache-Control: no-cache, no-store, must-revalidate, proxy-revalidate, max-age=0 # 👎
Cache-Control: no-store # 👍

throw the kitchen sink is almost meaningless and not only waste bytes but also implementation could cause a problem because no-store and other directives are semantically conflicted.

reload request (max-age=0 or no-cache)

semantically, no-cache should works fine when you do like Reloading of browser.
(but I don't know why browser sends max-age=0 when reloading instead of no-cache.
if there are some reason/use-case for max-age=0 it could be noted here too)

I'll update if I remember more ideas. Correct me if I also misunderstood.
Thanks

mnot added a commit that referenced this issue Mar 12, 2021
@mnot
Copy link
Member

mnot commented Mar 12, 2021

I think most of these are now addressed in the text. I didn't attempt some as they seem too detailed / situational (the spec is already pretty long!).

Thanks,

@mnot mnot closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants