ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Allow any protocol for cors origins

Open iterion opened this issue 1 year ago • 9 comments

What this PR does / why we need it:

Some applications which wrap browsers (like Tauri) use an origin such as tauri://localhost. Since the ingress-nginx regex only allows http[s] that means we can't easily enable cors for our tauri app.

This PR broadens the regex for the origin to allow any protocol. From my read, the regex that is generated for the nginx config should still correctly work with any protocol.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] CVE Report (Scanner found CVE and adding report)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation only

Which issue/s this PR fixes

How Has This Been Tested?

I've updated the tests to cover a case I'd like to see, and I'll be doing further testing in our environment soon.

Update: we've deployed this to production and it's been working as expected for us and fixes our Tauri cors issues.

Checklist:

  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I've read the CONTRIBUTION guide
  • [x] I have added unit and/or e2e tests to cover my changes.
  • [x] All new and existing tests passed.

iterion avatar Mar 22 '24 22:03 iterion

Welcome @iterion!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Mar 22 '24 22:03 k8s-ci-robot

Hi @iterion. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

k8s-ci-robot avatar Mar 22 '24 22:03 k8s-ci-robot

Deploy Preview for kubernetes-ingress-nginx ready!

Name Link
Latest commit 728e48c1a26c086012b20e2c6a16c89baeaf3e8a
Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/66d323c4e8f0960008292cda
Deploy Preview https://deploy-preview-11153--kubernetes-ingress-nginx.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 22 '24 22:03 netlify[bot]

/ok-to-test /triage accepted /kind feature /priority backlog

@iterion can you check on the golint error and/or add an ignore statement

strongjz avatar Mar 27 '24 15:03 strongjz

Done! I noticed elsewhere enableAnnotation is used for similar circumstances, so I just repeated that idiom here to fix the lint.

iterion avatar Mar 27 '24 17:03 iterion

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

github-actions[bot] avatar May 12 '24 01:05 github-actions[bot]

The lifecycle/frozen label can not be applied to PRs.

This bot removes lifecycle/frozen from PRs because:

  • Commenting /lifecycle frozen on a PR has not worked since March 2021
  • PRs that remain open for >150 days are unlikely to be easily rebased

You can:

  • Rebase this PR and attempt to get it merged
  • Close this PR with /close

Please send feedback to sig-contributor-experience at kubernetes/community.

/remove-lifecycle frozen

k8s-triage-robot avatar May 12 '24 04:05 k8s-triage-robot

/lgtm Leaving for some other @kubernetes/ingress-nginx-maintainers to approve

rikatz avatar Aug 22 '24 22:08 rikatz

/lgtm Thanks

rikatz avatar Aug 31 '24 14:08 rikatz

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iterion, rikatz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Aug 31 '24 14:08 k8s-ci-robot