Add request header for NoState Prefetch |
|||
Issue descriptionThere do not appear to be any Purpose: request headers set for no-state prefetch. If a page is fetched via <link rel=prefetch>, a Purpose: prefetch header is added to the request. If prerender is enabled, and a page is fetched by <link rel=prerender>, there is no Purpose: header, but any javascript in the page has the page visibility API to determine where the page came from. As far as I can tell, if no-state prefetch is enabled, and a page is fetched by <link rel=prerender>, there is no Purpose: header and neither is there any positive JS signal (since there is no JS at all). Thus there is ambiguity from the perspective of this site about where the resource is coming from. The context is from a client, where (according to a customer service rep): > "search this site" on the results page is resulting a large spike > of traffic that their attribution model cannot distinguish from > regular SEM traffic which is causing them to drop their SEM bids. Distinguishing no-state from prerender is possible although inconvenient, by looking for lack of JS execution. Presumably the same thing could be done in the future when there is no prerender at all, to distinguish no-state fetches from regular fetches. Although there might be a problem about distinguishing no-state fetches discovered during the preload scanning from regular page load preload scanning? At any rate, I couldn't find anything in the spec about what headers are necessary to add for link rel: https://html.spec.whatwg.org/multipage/semantics.html#obtaining-a-resource-from-a-link-element But there seems to be some consensus that a header should be added, eg scroll to "As a server admin, can I distinguish prefetch requests from normal requests?" in the following: https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ or this ancient webkit bug which describes chrome's old X-Purpose header: https://bugs.webkit.org/show_bug.cgi?id=46529 Note that chrome appears to now have just a Purpose header, I wasn't able to find the history of that change (there's no bug matching "x-purpose").
,
Jun 19 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d52474c3202ace50d3a849ec2b19f7ae4191a3d5 commit d52474c3202ace50d3a849ec2b19f7ae4191a3d5 Author: Egor Pasko <pasko@chromium.org> Date: Tue Jun 19 12:03:22 2018 NoStatePrefetch: Add Purpose:prefetch header The header should be set for all requests originating from nostate-prefetch, main resource, all redirects and all subresources. Using base::BindRepeating in new tests because of presubmit warning, also switched similar tests to it for consistency. Bug: 796855 Change-Id: I90614fac595f2dbc087a6ac99f54e2fc7d37f89a Reviewed-on: https://chromium-review.googlesource.com/1104692 Commit-Queue: Egor Pasko <pasko@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Matthew Cary <mattcary@chromium.org> Cr-Commit-Position: refs/heads/master@{#568409} [modify] https://crrev.com/d52474c3202ace50d3a849ec2b19f7ae4191a3d5/chrome/browser/chrome_content_browser_client.cc [modify] https://crrev.com/d52474c3202ace50d3a849ec2b19f7ae4191a3d5/chrome/browser/prerender/prerender_nostate_prefetch_browsertest.cc [modify] https://crrev.com/d52474c3202ace50d3a849ec2b19f7ae4191a3d5/chrome/common/prerender_url_loader_throttle.cc [modify] https://crrev.com/d52474c3202ace50d3a849ec2b19f7ae4191a3d5/chrome/common/prerender_util.cc [modify] https://crrev.com/d52474c3202ace50d3a849ec2b19f7ae4191a3d5/chrome/common/prerender_util.h
,
Jun 20 2018
hm, seems like it was not reverted :)
,
Sep 10
now in M69 Stable \o/ |
|||
►
Sign in to add a comment |
|||
Comment 1 by mattcary@chromium.org
, Dec 21 2017