GeezerVison is showing github.com — Fixed handling of origin when allow_credentials enabled by TiARETiK · Pull Request #985 · CrowCpp/Crow
Conversation
TiARETiK
commented
Jan 16, 2025
•
edited by gittiver
Loading
Uh oh!
There was an error while loading. Please reload this page.
There are two things to start with:
- OPTIONS requests are not expected to have
Origin header.
- OPTIONS responses are not expected to have an
Access-Control-Allow-Credentials headers.
- No response may have both
Access-Control-Allow-Credentials=true and Access-Control-Allow-Origin=*. (source)
Currently, the master branch's response to OPTIONS request contains an Access-Control-Allow-Origin= , which is interpreted incorrectly by most browsers. We can't fix it by simply checking for the presence of an Origin header in the request, due to the possibility of sending out both Access-Control-Allow-Credentials=true and Access-Control-Allow-Origin=*. The simple yet correct way to fix that behavior is to specifically check that the request being answered is not an OPTIONS one. Such a check is implemented in this pull request. There is also a test added that checks for incorrect Origins-Credentials behavior.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
@gittiver is the current state of the pull request acceptable, or shall I do something more for it to be accepted?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I simply overlooked the review, sorry.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gittiver
gittiver approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.