-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
in_http: allow empty Origin header requests to pass CORS checks #4866
base: master
Are you sure you want to change the base?
Conversation
Some requests, such as those made by apps, certain automated scripts, or older browsers, may not include an Origin header. Previously, such requests were blocked by the CORS check, even though they may not necessarily be cross-origin. This change updates the CORS handling logic to allow requests with an empty Origin header to pass, ensuring compatibility with legitimate non-browser clients while maintaining security. Signed-off-by: Richard Lee <14349+dlackty@users.noreply.github.com>
@dlackty Thanks for this PR! |
I see. Given this CORS specification, this On the other hand, it would also be possible that I would like to hear opinions on this point. Note:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least, there would be no problem to relax the condition like this PR.
(In the first place, I don't think it is necessary to return 403.)
I will wait a while, and if there are no objections, I will merge this.
Thanks!
Suggestion: To avoid breaking compatibility while still allowing requests with an empty Origin header, we could consider allowing For example: cors_allow_origins [nil, "example.com", "another-domain.com"] This way: Would love to hear your thoughts on this approach! 🚀 |
I see! Thanks! Even if we have a workaround, I see no problem with this change. If anyone has a different opinion, please let me know. |
Which issue(s) this PR fixes:
What this PR does / why we need it:
Some requests, such as those made by apps, certain automated scripts, or older browsers, may not include an Origin header. Previously, such requests were blocked by the CORS check, even though they may not necessarily be cross-origin.
For CORS, the server is responsible for reporting the allowed origins. The web browser is responsible for enforcing that requests are only sent from allowed domains. So this change updates the CORS handling logic to allow requests with an empty Origin header to pass, ensuring compatibility with legitimate non-browser clients while maintaining security.
Docs Changes:
Release Note: