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

Issue 830118 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug


Show other hotlists

Hotlists containing this issue:
Hotlist-1


Sign in to add a comment

Enabling Client Hints forces image requests to be CORS preflighted requests

Reported by mr.gerar...@gmail.com, Apr 7 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce the problem:
1. Run a local server (or host files)
2. Load HTML page in Chrome and confirm SW is running
3. Refresh page to capture image requests via runtime caching, confirm image requests go from "simple" to "preflighted" CORS requests per errors in dev console

What is the expected behavior?
By adding Client Hints, the image requests should still be "simple" (non-preflighted) requests.

What went wrong?
By adding Client Hints, the image requests were preflighted CORS requests.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 65.0.3325.181  Channel: stable
OS Version: OS X 10.11.6
Flash Version: 

Looks like this discussion happened in the past and Client Hints should be treated as CORS simple headers:
https://github.com/whatwg/fetch/commit/404dc3acfddb5e9870fdee333302f80ecff661dd

Per: https://github.com/httpwg/http-extensions/issues/141

And earlier:
https://github.com/igrigorik/http-client-hints/issues/68#issuecomment-163578440

But Chrome is still treating Client Hints as preflight.
 
image-ch-cors-preflight.zip
2.4 KB Download
The attached zip file contains a test HTML page with Client Hints enabled + a Workbox Service Worker using a runtime CacheFirst strategy for images. 
Cc: y...@yoav.ws tbansal@chromium.org
+Yoav, +Tarun: do either one of you guys have bandwidth to tackle this one?
Cc: -tbansal@chromium.org
Owner: tbansal@chromium.org
Status: Assigned (was: Unconfirmed)
Cc: tyoshino@chromium.org toyoshim@chromium.org
We should include all client hint headers as well in that list:
https://cs.chromium.org/chromium/src/third_party/WebKit/common/client_hints/client_hints.cc?rcl=34478381b6adb0298c4103ea72e2c2b88aaa1502&l=11
Labels: -Pri-2 M-67 OS-Android OS-Chrome OS-Linux OS-Windows Pri-1

Comment 7 by y...@yoav.ws, Apr 8 2018

tbansal@ - Thanks for taking ownership. I'm happy to help with reviews.

Comment 8 by y...@yoav.ws, Apr 9 2018

Thinking about this some more, is this a current problem, now that https://bugs.chromium.org/p/chromium/issues/detail?id=816661 is fixed?

It makes sense to add the headers to the safe list, but I think what the OP is currently experiencing as preflights will very soon be blocked entirely. (until a Feature Policy opt-in is landed)
Labels: -Pri-1 -M-67 FoundIn-65 Pri-3
Re #8: You are right. Cross-origin client hints would be blocked entirely in M-67. Regardless, I am going to add the headers to the safe list to be spec compliant.
Project Member

Comment 10 by bugdroid1@chromium.org, May 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/74e189d8d0717c2ce65a891e3fdc1a477c93c00c

commit 74e189d8d0717c2ce65a891e3fdc1a477c93c00c
Author: Tarun Bansal <tbansal@chromium.org>
Date: Mon May 07 19:07:35 2018

Add client hints headers as CORS safe headers

Client hints are device-specific and not origin specific. This
brings Chromium to be spec-compliant.

Bug:  830118 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I5a645c1d89fb7800168a2bdf571122f1dce01743
Reviewed-on: https://chromium-review.googlesource.com/1000879
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556518}
[modify] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/chrome/browser/client_hints/client_hints_browsertest.cc
[modify] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/services/network/public/cpp/cors/cors.cc
[modify] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/services/network/public/cpp/cors/cors_unittest.cc
[add] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/third_party/WebKit/LayoutTests/external/wpt/cors/client-hint-request-headers.htm
[modify] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/third_party/WebKit/LayoutTests/external/wpt/cors/simple-requests.htm
[modify] https://crrev.com/74e189d8d0717c2ce65a891e3fdc1a477c93c00c/third_party/blink/public/platform/web_client_hints_types.mojom

Labels: M-68
Status: Fixed (was: Assigned)

Sign in to add a comment