Skip to content

Make CORS headers configurable #541

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

Closed
deliahu opened this issue Nov 1, 2019 · 9 comments
Closed

Make CORS headers configurable #541

deliahu opened this issue Nov 1, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@deliahu
Copy link
Member

deliahu commented Nov 1, 2019

Description

Option 1:

kind: api
name: my-api
...
enable_cors: true

Option 2:

kind: api
name: my-api
...
cors:
    Access-Control-Allow-Origin: <string>
    Access-Control-Allow-Headers: <string>
@deliahu deliahu added the enhancement New feature or request label Nov 1, 2019
@deliahu deliahu changed the title Make CORS headers cofigurable Make CORS headers configurable Nov 1, 2019
@wise-east
Copy link

How can we configure CORS for the current version? I see #539 is closed.

@deliahu
Copy link
Member Author

deliahu commented Apr 2, 2020

Tagging @vishalbollu who has spent the most time on CORS. I believe @wise-east is running v0.14 (please correct me if I'm wrong)

@wise-east
Copy link

@deliahu Yes, I'm using v0.14 for now. Thank you.

@vishalbollu
Copy link
Contributor

@wise-east Issue #539 was addressed by returning a blanket

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: * # can be configured if request sends Access-Control-Request-Headers 

The ability to specify custom CORS headers as described in this ticket hasn't been implemented yet. Do you think returning responses with the headers above will satisfy your current requirements in the meantime?

Thanks for bringing this up. I just looked through our serving code and I think I found a bug in Cortex versions >= 0.14.0 that prevents the server from handling CORS correctly. Specifically, I don't think the server responds correctly to OPTIONS requests. We will investigate this issue more thoroughly.

@wise-east
Copy link

Forgive my ignorance, I'm not sure what you mean by addressed by returning a blanket. Can you elaborate?

If the problem is with versions >=0.14.0, and if I want to be able to handle CORS now, is it possible to do so by using a previous version (<0.14.0)? If so, can a newly installed cortex pick up the cluster I have set up with the current installation of cortex after I uninstall my current installation? Or will I have to do cortex cluster down and then uninstall and reinstall and do cortex cluster up again? I hope that since my AWS credentials will be the same that I won't have to do this and be able to use a previous version.

@vishalbollu
Copy link
Contributor

@wise-east Apologies, what I meant by addressed by returning a blanket was that the CORS that we had in <0.14.0 returned "*" or equivalent for CORS headers like Access-Control-Allow-Origin and Access-Control-Allow-Headers.

You should be able to get it working with Cortex version <0.14.0. If it is not too urgent, I would recommend waiting because we are looking to release 0.15.1 that should address the CORS issue and a CLI bug fix either today or tomorrow.

cortex cluster down, install cortex CLI with your desired version and cortex cluster up is the safest upgrade path at the moment because mismatched versions may cause compatibility issues.

@wise-east
Copy link

I see. I was actually able to bypass the issues for now with the guide provided to me at https://www.cortex.dev/v/master/guides/api-gateway by @deliahu

@deliahu
Copy link
Member Author

deliahu commented Apr 2, 2020

@wise-east sounds good!

We just release v0.15.1 in case you want to upgrade, just letting you know

@deliahu
Copy link
Member Author

deliahu commented May 21, 2020

Closing since this is now supported

@deliahu deliahu closed this as completed May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants