-
Notifications
You must be signed in to change notification settings - Fork 179
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
Support OPTIONS requests #104
Comments
Yeop, Ariadne only supports We'll be fixing that, but in meantime you would have to wrap |
Great! Thank you @rafalp ! |
Hi, I am currently running 0.5.0 and still get the same error. Going through the source code I cannot find an example using a CORS middleware namely one that instantiates GraphQL with a cors middleware such as CORSMiddleware from starlette.middleware.cors. Any help is highly appreciated. Thanks |
Hihi Patrys, Many thanks for your reply; the buzzling bit in my case is how do I tell GaphQL to use this middleware namely: from starlette.applications import Starlette app = Starlette() then when I look into ariadne example I have so how do I tell GraphQL to use this particular middleware? Many thanks, |
You can wrap one in the other:
GraphQL middlewares are separate from ASGI middlewares. |
Excellent, many thanks really appreciated :) |
Existing CORS middlewares already solve this problem, so we'll won't be doing this in Ariadne proper. Still, we'll want to eventually document this in our docs: mirumee/ariadne-website#5 |
I get Here is how I set up my middlewares: app = Application(routes=routes, debug=True)
app.mount('/graphql', CORSMiddleware(GraphQL(schema, debug=True), allow_origins=['*'])) |
Are you sure you're not missing a trailing slash somewhere (eg. that the server is not trying to redirect you to the correct URL)? |
You're right. I looked at the URL forever to figure out if it was my fault, but I just didn't see it. Thanks alot. :-D |
@seimsel do you have example for |
No. I never used this. |
Hey guys I'm confused how do I set this up if I'm using flask_restful like so
|
What do you want to setup? CORSMiddleware? |
I was just trying to get CORS setup to allow origin * as my client is on a different port. I was just playing with this I think I might have found something that works when I use flask_cors, is that the right way to do this if I use ariadne?
|
As far as I see Ariadne never sees any http request at all (since you're using graphql_sync). So this is a question on how to handle CORS in Flask. For which it seems you are on the right track. |
Thank you! |
Hi, I keep getting a
405
when using the example code, and I'm wondering if it's a CORS issue, since my frontend and backend are running on different ports. If so, how do I enable CORS with Ariadne?The text was updated successfully, but these errors were encountered: