WICG / ua-client-hints

Wouldn't it be nice if `User-Agent` was a (set of) client hints?
https://wicg.github.io/ua-client-hints/
Other
583 stars 75 forks source link

Sketch interaction with caching intermediaries #207

Open twifkak opened 3 years ago

twifkak commented 3 years ago

In addition to helping proactive content negotiation in the endpoint server, it seems like this would help caching intermediaries:

Is this a goal, a non-goal (nice side effect that may break), or an anti-goal (non-desired side effect)?

If a goal, it would be nice to sketch out how this could be achieved, for example by appending to Appendix A of Variants.

miketaylr commented 3 years ago

Is this a goal, a non-goal (nice side effect that may break), or an anti-goal (non-desired side effect)?

I think @yoavweiss will have more intelligent thoughts to this issue than me... 😅

yoavweiss commented 3 years ago

The fact that the different content negotiation dimensions are broken up into separate headers which can be Varyied on was definitely a goal in the design, and is mentioned in the RFC.

I'm not sure what flow you have in mind regarding cache pre-warming though. It seems like you'd need to gather "intelligence" for a while on the server before have some certainty that you have all the variants, right? Is that materially different than simply caching the variants as they come? Or are you thinking of applying variants from one resource onto other resources?

twifkak commented 3 years ago

Prewarming is secondary (to me) to the cache key, but AFAICT the Variants spec designs for both use cases. The endpoint server specifies a list of variants it serves (both key and value). No longitudinal intelligence-gathering necessary.

To integrate a header with Variant-Key / Variants from that spec, it appears two things are necessary:

In both cases, this seems pretty simple, but worth defining explicitly. (Especially the latter, given that UA is a GREASEd set.)

twifkak commented 3 years ago

I should add: I don't mean to advocate for Variants in particular (at least not in this thread). But I think it's a useful reference, as the "two things" necessary for Variants would also be useful for a caching scheme based on Vary.