Skip to content
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

Status Code: 405 Method Not Allowed #3

Closed
songololo opened this issue Apr 17, 2017 · 3 comments
Closed

Status Code: 405 Method Not Allowed #3

songololo opened this issue Apr 17, 2017 · 3 comments
Assignees

Comments

@songololo
Copy link

songololo commented Apr 17, 2017

I am trying to use sanic-graphql but am encountering a Status Code:405 Method Not Allowed error.

The <url>/graphql endpoint (graphiql) works fine. However, when trying to use the endpoint from an apollo-client website then I encounter the above-mentioned Status Code 405 error when the browser attempts an OPTION preflight request.

This is presumably somehow related to the sanic documentation for Class-Based Views which states that if the the class based view does not contain the request method (in this case the OPTION preflight request), then a 405: Method not allowed error is returned.

Is there some way to resolve this?

Thanks.

@grazor grazor self-assigned this Apr 18, 2017
@grazor
Copy link
Member

grazor commented Apr 18, 2017

Hi @Shongololo!

Thanks for your report! This issue is indeed caused by sanic not supporting CORS and thus ignoring preflight requests.

I've created a workaround for this requests. Could you please check if it works for you? You need to clone this repo, switch to fix/preflight branch and install it to new virtual environment. Assuming your venv is active:

git clone git@github.com:graphql-python/sanic-graphql.git
cd sanic-graphql
git checkout fix/preflight
python setup.py install

@songololo
Copy link
Author

songololo commented Apr 18, 2017

@grazor yes, it works now! Thank you very much. I'll use the fix/preflight branch until this is released via pip.

@grazor
Copy link
Member

grazor commented Apr 18, 2017

@Shongololo great! I've updated pypi package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants