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

Issue 835821 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Feature



Sign in to add a comment

"Preflight request for request with keepalive specified is currently not supported" on same-origin fetch requests

Reported by mfaust...@gmail.com, Apr 23 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36

Steps to reproduce the problem:
Perform a fetch() call on the current origin with a custom header and keepalive enabled: 

fetch('.', {headers: {'X-Test': '123'}, keepalive: true})

What is the expected behavior?
There should be no preflight required since the request is within the same-origin. With the keepalive set to false Chrome does not perform a preflight so it appears this check was added before it determines whether or not the request is CORS and requires a preflight.

What went wrong?
The fetch() call fails.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 66.0.3359.117  Channel: stable
OS Version: 10.0
Flash Version:
 
Labels: Needs-Triage-M66
Cc: sindhu.chelamcherla@chromium.org
Components: Blink>Network>FetchAPI
Labels: Triaged-ET Needs-Feedback
Tested the issue on 66.0.3359.117 using Windows 10, Mac 10.13.3 with steps mentioned below. Pasted fetch('.', {headers: {'X-Test': '123'}, keepalive: true}) in devtools console and observed error as VM87:1 Preflight request for request with keepalive specified is currently not supported
(anonymous) @ VM87:1
PromiseĀ {<rejected>: TypeError: Failed to fetch
    at <anonymous>:1:1}
VM87:1 Uncaught (in promise) TypeError: Failed to fetch
    at <anonymous>:1:1

@Reporter: Could you please check the screenshot and let us know if this is the behavior you are seeing? If not please provide a sample URL or test file to test this issue. 

Thanks!
835821.png
241 KB View Download

Comment 3 by mfaust...@gmail.com, Apr 24 2018

Yes, that is the behaviour being observed. I've also attached a test file that demonstrates the issue.
fetch_keepalive_same-origin_no-cors.html
190 bytes View Download
Project Member

Comment 4 by sheriffbot@chromium.org, Apr 24 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: vamshi.kommuri@chromium.org
Labels: Needs-Feedback
Checked the issue on reported chrome version 66.0.3359.117 using Windows 10 with the below mentioned steps.
1. Launched chrome
2. Downloaded "fetch_keepalive_same-origin_no-cors.html" file provided in comment#3 and opened it in a new tab.
3. Opened DevTools
It shows an error "Fetch API cannot load". Attaching the screen shot of the same.

@Reporter: Could you please have a look at the screen shot and let us know if we have missed anything in the process. It would be highly helpful if confirmed on, whether the attached screen shot has an issue.

Thanks!
835821.PNG
257 KB View Download

Comment 6 by mfaust...@gmail.com, Apr 25 2018

The sample needs to be hosted on a webserver, it cannot be served by the filesystem. The error message shown in the screenshot of comment #2 is the error message in question.
Project Member

Comment 7 by sheriffbot@chromium.org, Apr 25 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
Tested the issue on chrome reported version 66.0.3359.117 using Windows 10 with steps mentioned below:
1) Launched chrome reported version, created a local server
2) Dragged and dropped the file provided in comment#3 and opened Devtools, seen the same error as mentioned in comment#5 screenshot

@Reporter: Please find the attached screencast for your reference and let us know if we missed anything in reproducing the issue, provide your feedback on it which help in further triaging it.

Thanks!
835821.mp4
2.7 MB View Download
Status: Untriaged (was: Unconfirmed)
fetch('.', {headers: {'X-Test': '123'}, keepalive: true}) can cause preflight due to redirect. It may be reasonable to relax the restriction for requests with mode: 'same-origin'.
Labels: -Type-Bug Type-Feature
You are still running the script from a file:// schema instead of an http:// or https:// as the error message in your video demonstrates. You need to host the example file on an actual web server such that you navigate to it via something like:

http://localhost/fetch_keepalive_same-origin_no-cors.html

If the URL bar in the browser shows file:// then you won't be able to reproduce the issue in this bug.

To move things along I've created a jsfiddle to demonstrate the bug in this issue: 

https://jsfiddle.net/pv8up9gd/

Comment 12 by ricea@chromium.org, Apr 27 2018

Owner: yhirano@chromium.org
Status: Assigned (was: Untriaged)

Sign in to add a comment