in response headers I see "Allow: GET, POST". How can I enable OPTIONS method on server?
sorry, using corsheaders fixed my issue.
can you provide a usage sample?
I've just used corsheaders and followed their documentation
@slavugan I also followed django-cors-headers's instructions and set CORS_ORIGIN_ALLOW_ALL = True.
And
returns "access-control-allow-origin →*". This means the cors-header is working. However,
returns error saying "only POST and GET are allowed", and POST returned no "access-control-allow-origin" header.
Could you show us how you enable OPTIONS method for graphql?
@dsun-ge
With the same issue, I figured out that I forgot to add
'corsheaders.middleware.CorsMiddleware',
in the middleware section:
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
...
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
...
]
Most helpful comment
@dsun-ge
With the same issue, I figured out that I forgot to add
'corsheaders.middleware.CorsMiddleware',in the middleware section:
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10 ... 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ... ]