Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

describe Access-Control-Request-Headers as optional part of preflight #28204

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

DinoChiesa
Copy link
Contributor

Description

Describe Access-Control-Request-Headers as an optional part of a preflight request.

Motivation

The current description of a preflight seems to indicate that the Access-Control-Request-Headers header will always be present. But per the fetch spec, that is not the case.

Per
https://fetch.spec.whatwg.org/#cors-preflight-fetch , Access-Control-Request-Headers is an optional part of a preflight. In practice, Chrome v115 does not send Access-Control-Request-Headers when there is no restricted header in the pending outbound request.

Additional details

https://fetch.spec.whatwg.org/#cors-preflight-fetch

specific wording is:

Let headers be the CORS-unsafe request-header names with request’s header list.

If headers is not empty, then:

  • Let value be the items in headers separated from each other by ,.

  • Append ([Access-Control-Request-Headers](https://fetch.spec.whatwg.org/#http-access-control-request-headers), value) to preflight’s header list.

Per
https://fetch.spec.whatwg.org/#cors-preflight-fetch , 
Access-Control-Request-Headers is an optional part of a preflight, and in fact, Chrome v115 does not send Access-Control-Request-Headers when there is no restricted header in the pending outbound request.
@DinoChiesa DinoChiesa requested a review from a team as a code owner July 26, 2023 23:00
@DinoChiesa DinoChiesa requested review from chrisdavidmills and removed request for a team July 26, 2023 23:00
@github-actions github-actions bot added the Content:Glossary Glossary entries label Jul 26, 2023
@github-actions
Copy link
Contributor

Preview URLs

@sideshowbarker sideshowbarker merged commit 8fb2786 into mdn:main Jul 26, 2023
5 checks passed
@sideshowbarker
Copy link
Collaborator

Dino, thanks much, and congrats on landing your first docs change here — welcome aboard 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Glossary Glossary entries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants