remove X-Requested-With: XMLHttpRequest header #8493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR effectively reverts the changes of PR #4934 (or more specific the commit 937c8f6).
Motivation and Context
As described in more detail in issue #6081, the use of the
X-Requested-With
header triggers a preflight on most authentication backends. Most authentication endpoints do not implement CORS, and when they do the headerX-Requested-With
is not in the list of allowed headers.Note that the motivation of the original PR that introduced this change seems to be debatable. The popup shown in the screenshots there seem to be caused by a backend sending a
WWW-Authenticate
header, which is kind of weird.Fixes #6081
How Has This Been Tested?
Running the latest swagger-ui with Dex IDP (https://dexidp.io/). My browser fails to fetch the token after going through the authorization code flow. Replacing swagger-ui with a local build of this PR results in successful authentication.
Screenshots (if appropriate):
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests