-
-
Notifications
You must be signed in to change notification settings - Fork 946
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
Simple way to allow all CORS / OPTIONS requests? #1220
Comments
Answering my own question:
|
It seems you have coined a solution that fits your needs 😈 Your question is otherwise actually answered in the FAQ [1], and the answer is really fairly similar to yours. Note the suggestion handles |
Also note that a simple to way to add unsophisticated permissive CORS is under consideration to be included in Falcon 2.0: #1194 |
The OPTIONS method is now supported for each route. This method can be used to check allowed methods. CORS is not yet supported. Something along [1], [2] or could be used. [1] https://stackoverflow.com/a/45183343 [2] falconry/falcon#1220 [3] https://github.com/lwcolton/falcon-cors Signed-off-by: Heikki Laaksonen <laaksonen.heikki.j@gmail.com>
DeprecatedWarning: Call to deprecated function init(...). API class may be removed in a future release, use falcon.App instead. use : `class HandleCORS(object): app = falcon.App(middleware=[HandleCORS() ])` |
Thanks for the tip, @MockArch 👍 Note though that as of Falcon 3.0+, the CORS functionality is now included in the framework. import falcon
# Enable a simple CORS policy for all responses
app = falcon.App(cors_enable=True) (You can also address some more complex use cases by adding an instance of |
I'm wanting to open the door wide to all CORS requests to my application.
I can see there is an additional Falcon/CORS middleware project but I'm hoping there is some simpler way to just open the door wide with a few lines of code and no need to worry about understanding and implementing the middleware and the various options and fine tuning that it provides.
Any suggestions for how to do this?
The text was updated successfully, but these errors were encountered: