corydolphin / flask-cors

Cross Origin Resource Sharing ( CORS ) support for Flask
https://flask-cors.corydolphin.com/
MIT License
877 stars 137 forks source link

Origins parameter to accept a function to determine match #238

Open peterlada opened 5 years ago

peterlada commented 5 years ago

@corydolphin Would you be welcoming a PR to add functionality to the origins parameter, to allow passing a function reference which can be called to to determine if the origin matches?

Use case: I have an app that serves pages on many (on ours and clients') domains. This list is stored in the DB, and can be cached in the server's memory. Allowing a function to determine the origin match would help me to implement this feature with relative ease.

If you have objections to allowing (yet another) type of value for origin, I'd understand, but if you have preference for a different way of getting this accomplished, that'd be welcome too!

corydolphin commented 5 years ago

Yes! I would welcome it!