-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Template: Fix faulty CORS headers handling. #12424
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: elizabeth-dev 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 |
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-sigs/prow repository. |
Hi @elizabeth-dev. 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-ingress-nginx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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'd not call it a fix if we need to introduce NJS for it. We also already have a different PR for introducing NJS but as this needs a working NGINX base image build, we first need to fix this, introduce NJS and then can rebase this PR on top.
@Gacko in that case we can prioritize and merge the NJS PR first, and then add this on top of it as just a fix |
Yes, makes sense! Sadly we can first release it in v1.13. Also I wouldn't word it as a fix then. Does this make sense? |
@Gacko hmm, not sure if I understand. you wouldn't tag the other PR (adding NJS + some migrations) as a fix, I agree with that, but once that is merged whenever, we can put this change on top, then it'd just be the scripting part, and that would pass as "just a fix" for me, since no new modules would be added and the logic would stay the same (but working as expected) or do you prefer to pass both changes as new features? |
Hm, yeah, you're right. We can consider this a fix. It's just a bit complex as we are also changing the whole framework the implementation is based on. |
well, that's settled then. we'll see if we can fix the build issues soon /hold |
Signed-off-by: Anurag Rajawat <[email protected]>
c291656
to
49ab05e
Compare
What this PR does / why we need it:
CORS headers handling implementation has been producing inconsistent results for a bit due to the unusual way Nginx handles
if
directives (essentially, they are to includereturn
andrewrite
directives only inside them). This change recreates the exact same logic we were trying to apply whe handling CORS, but using NJS scripting.This also includes the NJS module into our custom build of Nginx, since it was going to be necessary for #12383 anyway.
Types of changes
Which issue/s this PR fixes
fixes #10267
How Has This Been Tested?
Test cases including multiple origin, headers, and methods have been run using curl, in order to ensure all the different CORS headers behave accordingly to the different annotation values we allow. This also included the specific configuration a user reported failing in the linked issue.
Additionally, most of the CORS e2e test suite has been revised and improved, relying more on actually checking the result of HTTP requests rather than just checking the contents of the nginx.conf file.
Checklist: