#32883: CORS issue with flutter web and django!
-------------------------------------+-------------------------------------
Reporter: dev- | Owner: nobody
akshat |
Type: Bug | Status: new
Component: HTTP | Version: 3.1
handling | Keywords: CORS , flutter ,
Severity: Normal | django_rest_framework , flutter_web
| , response , request , rest api ,
Triage Stage: | json
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Sending request to django-rest-framework api from flutter web always
results in CORS error sppecifically this Access to XMLHttpRequest at
'http://127.0.0.1:8000/' from origin 'http://localhost:62570' has been
blocked by CORS policy: Request header field access-control-allow-origin
is not allowed by Access-Control-Allow-Headers in preflight response.
In flutter: Tried putting ever possible header in request headers, not
working!
In django: Tried making ALLOWED_HOSTS = ['*'] & adding corsheaders at top
of middleware list and doing CORS_ALLOW_ALL_ORIGINS = True. Still got the
same CORS error. Changing port no of gjango or even flutter doesn't make
any change.
This same API is working successfully with react and angular (giving
correct response).
There is no issue in flutter framework as it is working fine and getting
correct response with other similar API developed using NestJS and dotNet.
I have also opened the issue in stackoverflow
Checklist
Raised initially as discussion #...
This cannot be dealt with as a third party library. (We prefer new
functionality to be in the form of third party libraries where possible.)
I have reduced the issue to the simplest possible case.
--
Ticket URL: <https://code.djangoproject.com/ticket/32883>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.ef7b641e27e48486e33f399fb75501c1%40djangoproject.com.