-
Notifications
You must be signed in to change notification settings - Fork 149
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
Scoping of Accept-CH #307
Comments
With the benefit of few years of experience, absence of hints on the initial request has proven to be a major limitation that prevented wider adoption. In practice, many of the most critical decisions about page format are made when the HTML is generated -- e.g. whether you should serve "light" version of the page, picking resource density, ..., and feature-detecting support for CH to begin with. In short, we do need to allow hints on navigation responses.
I think that's a reasonable definition for
|
DNT has a mechanism for determining if the DNT:0 header sent to subresources, a JS API for specifying "site-specific" consent. This also can specify lifetime by having an "expires" or "maxAge" property in the parameter dictionary for the call. The TPWG has discussed using cookies as a more generic method, but the SOP gets in the way (you cannot limit the state to a top level context). The Accept-CH header is similarly determining stateful site-specific behaviour for subresources, perhaps this points to a generalised solution? Especially as there are privacy/user control issues in common? I am thinking about a well-known cookie prefix (as proposed for RFC6265bis) that would cause the cookie to be sent to subresources in the cookie header, but only within the context of the parent that placed it. The existence of particular forms of this well-known cookie could then determine UA behaviour (such as sending Client Hints to subresources). Implementation would be simpler because the expiry procedures are already in place. A further advantage would then be that the state is automatically contained in the UAs cookie store, accessible to existing privacy oriented UA UIs and extensions, increasing transparency. For example: Set-Cookie: __SRAccept-CH=DPR;expires=Sat, 05 Mar 2017 00:00:00 GMT |
@igrigorik - Just thinking through doing this, a couple of questions -- It seems like there are a lot of potential dimensions that the server's preferences for sending CH could vary -- e.g., same-origin vs. third-party, navigation vs. subresource, etc. Are we offering the right capability (all requests from a given origin) here? Will having one Using a cache to determine whether to sent hint headers means that the initial navigation request to a given origin won't have them, so any behaviour that depends on them will need a fallback. Is that just going to be "serve the heavier page", or something more complex? |
Based on the experience and feedback so far.. yes. It's the simplest strategy that covers all the use cases, and everything else just adds more configuration and implementation complexity.
Last registration wins, similar to HSTS.
The former. Practically speaking, sites can't rely on CH hints being available from every browser in any case, so they need a fallback strategy regardless. |
@mnot @mikewest would love to hear your thoughts on the cookie opt-in idea floated above.
Do we have any other precedents that use cookies for feature opt-ins? Any gotchas with going down this path, spec/layering and implementation wise? It's also unclear to me whether we'd really need to invent new prefixes.. hoping the answer is "no". |
From a practical perspective, this sounds expensive if we need to consult the cookie monster for every request. I suspect that we'd internally need to turn this into something like HSTS where we store the pins distinctly from cookies, at which point we lose much of the elegance of the proposal, I think. From a theoretical perspective, this is breaking new ground. We don't have any other special-purpose cookies that I know of. We'd need to reserve the name in some way (which is absolutely doable, if odd). Also, cookies have terrible scoping rules. The less eTLD+1 we have, the better, from my perspective. From a pinning perspective, spelling the pin as |
Right, you confirmed my main worry. Solving this problem via cookies is doable, but brings a lot of unrelated complexity that I'd much rather avoid. I'm inclined to keep things simple and...
I'll take a run at a PR for the above. |
First run at |
Doesn't "the cookie monster" have to be consulted anyway for every request? If only to work out what to put in the Cookie header? My idea was mainly to give users (and privacy protection extensions) the ability to detect the existence of the CH state by keeping it in the same place as cookies, where there already exist UIs etc. for seeing/dealing with them. If a parallel system is implemented to manage CH state (with expiry etc.) then there would also be a need for similar UIs, API to support extensions etc. For cookies that already exists. It is true the scoping rules are horrible, but they do not need to be used for these special prefixes. The "secure" attribute already restricts scoping for some cookies. |
Not from inside the rendering engine, which is where CH headers are added. |
The
Accept-CH
response header is defined as:"All future requests" is a long time indeed. While of course the client isn't going to literally do that (eventually it'll be garbage collected, or the user will reset state, or the machine will be recycled), from a server-side perspective, it'd be nice to have some level of control over how bloated your requests get.
Additionally, having
Accept-CH
possibly indicate that future references to and from this origin seems like a pretty broad brush to be painting with. While Chrome might make some reasonable decisions about tradeoffs here (and probably needs some wiggle room), if this ever does get implemented elsewhere, this broadness and freedom is a recipe for bad interop and worse server-side headaches.So, can we nail this down at all?
The most conservative approach is:
"Send CH headers on subrequests generated by this content, please."
However, the above also says "subsequent requests initiated to the same server" in the primary spot; the case above is relegated to "optionally."
Personally, my preference would be to drop "subsequent requests initiated to the same server and, optionally" and the corresponding text in the example below it. The primary use case for CH as I understand it is serving appropriate subresources, NOT dynamically modifying HTML, so that should do the trick.
Am I missing something, @igrigorik?
Regardless of that, "server" is used very loosely above; I think you mean "origin", right? And "can" should probably be "MAY".
CC @yoavweiss
The text was updated successfully, but these errors were encountered: