-
Notifications
You must be signed in to change notification settings - Fork 338
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
How do I enable CORS? #421
Comments
You need to add a "After request" function on your app definitiion, like: app = Flask(name) |
Hi! Did you try to add this in the example I provided? I tried adding it there and it didn't do anything. I tried to add it under |
@Jerakin Hi! Have you found a solution? |
Paused working on this part of the website for a while, until a few days ago and am still unable to solve it even with a fresh mindset. Adding to our plight is that this project now looks like it is no longer maintained, in the future I will have to look into migrating away from restx and would recommend others to do the same. |
Summary: Trying to add CORS to my flask-restx app but failing. Is my setup correct? Can someone see if there is something wrong with my general setup or if flask-restx simply doesn't work with the kind of setup I am trying to accomplish?
I have made a issue on https://github.com/corydolphin/flask-cors (#308) too, but now I am thinking that it's probably on
flask-restx
side on things maybe.In the console that is running flask I don't get any relevant logs and the website is saying
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1/api/v1/test. (Reason: CORS request did not succeed). Status code: (null).
I don't even get any indication in the logs that the server received an"OPTIONS"
request.I would greatly appreciate it if someone could just run my repro case below so that I at least know that it isn't just my machine.
Running it with
FLASK_ENV=development
and simplyflask run
.The text was updated successfully, but these errors were encountered: