New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 796855 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 632361
issue 796738



Sign in to add a comment

Add request header for NoState Prefetch

Project Member Reported by mattcary@chromium.org, Dec 21 2017

Issue description

There 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").

 
Blockedon: 796738

Comment 2 by pasko@chromium.org, Dec 27 2017

Blockedon: -796738
Blocking: 796738 632361
Project Member

Comment 3 by bugdroid1@chromium.org, 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

Comment 4 by pasko@chromium.org, Jun 20 2018

Cc: kenjibaheux@chromium.org
Status: Fixed (was: Untriaged)
hm, seems like it was not reverted :)
Owner: pasko@chromium.org
now in M69 Stable \o/

Sign in to add a comment