Skip to content
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

Support wildcards in ingress.kubernetes.io/cors-allow-origin #853

Closed
nabadger opened this issue Sep 13, 2021 · 2 comments · Fixed by #927
Closed

Support wildcards in ingress.kubernetes.io/cors-allow-origin #853

nabadger opened this issue Sep 13, 2021 · 2 comments · Fixed by #927

Comments

@nabadger
Copy link

nabadger commented Sep 13, 2021

What are you trying to do

I'm making use of ingress.kubernetes.io/cors-allow-origin across multiple-domains and it would handy if we could support something like:

ingress.kubernetes.io/cors-allow-origin: "*.example.com, *.example2.com"

I think perhaps the current option of * is not restrictive enough for my needs...but at the same time being able to use wildcards for different domains would save a lot of management overhead (we have lots of hosts...).

Related: #477

@wolf-cosmose
Copy link
Contributor

wolf-cosmose commented May 30, 2022

I need a similar feature, though for my usecase it'd be best to support regexes.
From what I've seen, it'd be simple to implement in haproxy config, just a matter of adding -m reg to the ACLs in the template. However, haproxy-ingress's validation of the cors-allow-origin annotation doesn't allow regexes.

Currently I'm working it around using haproxy-ingress.github.io/config-backend with a copy of the CORS logic from the template, except with acl my_cors_allow_origin var(txn.my_hdr_origin) -m reg ^http://localhost:.*$ ...

Would a pull request adding regex support through an annotation like cors-allow-origin-regex be accepted?

@jcmoraisjr
Copy link
Owner

Hi, thanks for the proposal, sure it'd be a welcome contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants