-
Notifications
You must be signed in to change notification settings - Fork 8.4k
fix(cors): add 'vary: origin' header if not set by backend #10490
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kubernetes-ingress-nginx canceled.
|
This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @aslafy-z. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
That might actually be it. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#access-control-allow-origin I might have missed it when going through the docs. |
Should be roughly around this area for cors annotations. https://github.com/kubernetes/ingress-nginx/blob/main/test/e2e/annotations/cors.go#L430 |
fedd8a9
to
25477e5
Compare
@larivierec I implemented a test, feel free to give a look :) |
3f8cdbe
to
cb71d7e
Compare
@larivierec I added a conditional to only insert this header when needed and added tests to validate it. Please give a new look. |
lgtm |
@rikatz can you please have a look? |
@rikatz Is there something missing from that PR or can it go forward? |
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.
I left my review a year ago, hopefully the maintainers might find time to look at the issue
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aslafy-z, larivierec The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
bdd50c4
to
9eca8f3
Compare
Signed-off-by: Zadkiel AHARONIAN <hello@zadkiel.fr>
What this PR does / why we need it:
CORS with multiple allowed origin need to serve the 'Vary: Origin' header.
This can be done on the backend side, however, users delegates the CORS setup to their ingress.
For security reason, we disable their use of the snippet annotations, so they can't use it to insert the header.
This change conditionally add the 'Vary' header to 'Origin', if the header is not defined by the backend and the configured allowed origins matches one of these conditions:
*
)Types of changes
Which issue/s this PR fixes
relates to #8469 (comment)
How Has This Been Tested?
Checklist: