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

General CORS library #62

Open
CrowdHailer opened this issue Jan 4, 2019 · 3 comments
Open

General CORS library #62

CrowdHailer opened this issue Jan 4, 2019 · 3 comments

Comments

@CrowdHailer
Copy link
Contributor

This is pretty close to a feature request, but it looks like the right place for it and I'm willing to do much of the work.

Is there any interest in making this a general CORS library, i.e. not just a plug.

I think work needed would be

Why.

a) Useful in tests of APIs to check that the headers include the expected CORS headers
b) I, and quite a few others, use Raxx/Ace

@mschae
Copy link
Owner

mschae commented Jan 4, 2019

Hey and thanks for your input. I understand the need for a generalized CORS library.

I wonder if the plan you laid out is the way to go or whether we should have a separate package (maybe creatively named cors) that includes all the functionality and make cors_plug use that package.

Not sure which way I prefer...

@CrowdHailer
Copy link
Contributor Author

I can see why the second one might sound a good idea, but perhaps later on.

While the API is being developed/discovered I normally think it is better to have everything in one repo.

Main reason I would do as you suggest is because I'm not sure how well hex.pm handles renaming packages

@CrowdHailer
Copy link
Contributor Author

I've started a spike at a CORS middleware for Raxx. https://github.com/CrowdHailer/raxx/pull/157/files#diff-145629a0af7f990c2e3f756d6625052aR7

I now reckon just exposing a CORS.check(method, headers, config) is the simplest generic API.
Rather than having functions like check_origin and requiring each of plug/raxx/other to combine them in the correct order

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

No branches or pull requests

2 participants