agrueneberg / Corser

CORS middleware for Node.js
MIT License
91 stars 11 forks source link

Support for passing a function(origin, callback) as origins #7

Closed Nomon closed 11 years ago

Nomon commented 11 years ago

Hi,

We use your great CORS module in one of our upcoming new projects but we needed support to verify the origin against a large set of oauth2 redirect_uri's that are being added, changed and revoked so we added support for passing a function as options.origins. This way we can do asynchronous checking from redis. I do not know if this feature fits your plans for the module but here it is incase you want to add it to the actual module. We also unified the interface so that checking against an array uses the same path. Tests included.

Best wishes, Matti Savolainen / Nomon http://applifier.com

agrueneberg commented 11 years ago

Hi Matti,

I merged your code and appreciate your contribution. I really like the idea and intend to add a similar functionality to allow for dynamic checking of headers in the future.

I'm sorry for somewhat messing up merging your pull request. I used cherry-pick instead of merge, but it looks like it did not affect the ownership of your changes.

Anyway, I just pushed out version 1.2.0.

Thank you, Alex