WICG / client-hints-infrastructure

Specification for the Client Hints infrastructure - privacy preserving proactive content negotiation
https://wicg.github.io/client-hints-infrastructure
Other
61 stars 26 forks source link

browser retries from the beginning of the multiple redirection with critical-ch #123

Closed jen6 closed 2 years ago

jen6 commented 2 years ago

Hi, I'm working for an ad tech company. As part of the User Agent Reduction initiative (in Chrome), we (AB180 ad-tech company) are trying to implement browser hints with accept-ch and critical-ch. As I tested with critical-ch it retries the beginning of the redirection in each state. As #33 mentioned, "(1) Restart the request you're currently on, just with the new hints" is correct. But it acts like "(2) Restart from the beginning of the chain with the new hints". Is it just chrome's bug or updated spec?

I also made chrome bug issue.

Steps to reproduce the problem:

Problem Description:

arichiv commented 2 years ago

Interesting, I would have expected the chain:

abit.ly/kzjhsx -(302 redirection)-> dev.abr.ge/cctk0 (204 response) -(browser retry)-> dev.abr.ge/cctk0 -(302 redirection)-> dev.ablog.airbrdge.io (204 response) -(browser retry)-> dev.ablog.airbrdge.io

I'm not sure what's going on here, but I wonder if it's something to do with wanting to preserve the referrer and/or preventing one-time-use token breakage due to an unexpected retry in the middle of a chain. @yoavweiss and @miketaylr for other takes

jen6 commented 2 years ago

@arichiv Can you explain why you expected one more retry in dev.ablog.airbridge.io? I added permissions-policy in dev.abr.ge to prevent retry in dev.ablog.airbridge.io.

Also, If I test without abit.ly (means starts from dev.abr.ge/cctk0) there is no retry in dev.ablog.airbridge.io.

arichiv commented 2 years ago

Client hints are cached per-origin, and permissions policies are uncached. If any origin returns a Critical-CH header because client hints were missing, the load must restart in order to return the (now cached) client hints requested. Permissions policies cannot delegate hints across redirects, just to subresources/frames on the same page.

If the request for client hints has already been cached, then no retry will occur as the critical-ch can be omitted/ignored since required hints were already sent.

arichiv commented 2 years ago

More details are in https://bugs.chromium.org/p/chromium/issues/detail?id=1346230, the TL;DR is:

I think the current behavior is unfortunately correct, and that any Critical-CH restarts in the redirection chain really do need to restart from the top rather than acting as though they started in the middle of it otherwise the behavior isn't actually identical.