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

Enable CORS #121

Closed
g3gurung opened this issue Mar 3, 2017 · 6 comments
Closed

Enable CORS #121

g3gurung opened this issue Mar 3, 2017 · 6 comments
Labels
documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements stale Pull requests/issues with no activity

Comments

@g3gurung
Copy link

g3gurung commented Mar 3, 2017

I have successfully added

annotations:
    nginx.org/client-max-body-size: "10m"

and I tried to use cors by adding another annotation like this but it is not working
ingress.kubernetes.io/enable-cors: "true"

Is there some other way to enable cors!

@pleshakov
Copy link
Contributor

@g3gurung
unfortunately, the enable-cors annotation is not supported. However, I can suggest a few possible solutions:

@cheddarwhizzy
Copy link

cheddarwhizzy commented May 8, 2017

I'm adding support for CORS. I hope to create a Pull Request this week. The annotations I'm creating are 'nginx.org/cors-domains' and 'nginx.org/cors-enabled'. If just cors-enabled is defined, it'll allow all "*" Origins. Defining 'cors-domains' will act as a domain whitelist. I was going to add this to the server block rather than the location block. We can change 'nginx.org' to 'ingress.kubernetes.io' if that's better.

Does this sounds like a good solution?

@pleshakov
Copy link
Contributor

@bporter2387
That sounds good! Thanks!

It is important that all add_header directives are defined in the same level. For example, add_header directives defined in a location block overwrite any add_header directives in a server block.

nginx.org is better for now, as all other annotations are also nginx.org ones. We can add support for ingress.kubernetes.io annotations later, if we need to.

@pleshakov pleshakov reopened this May 9, 2017
@pleshakov pleshakov reopened this May 9, 2017
@cheddarwhizzy
Copy link

I created PR #144 . I added a 401 on non-whitelisted domains. Not sure if this ideal, but I noticed our upstream endpoints are still hit from non-whitelisted Origins unless I had this 401 in place. However, in browsers I still got the CORS error without the 401, so that's good.

@isaachawley isaachawley added enhancement Pull requests for new features/feature enhancements documentation Pull requests/issues for documentation labels Jul 30, 2018
@github-actions
Copy link

github-actions bot commented May 4, 2021

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale Pull requests/issues with no activity label May 4, 2021
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements stale Pull requests/issues with no activity
Projects
None yet
Development

No branches or pull requests

5 participants