[Django] #32883: CORS issue with flutter web and django!

39 views
Skip to first unread message

Django

unread,
Jun 26, 2021, 5:08:50 AM6/26/21
to django-...@googlegroups.com
#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.

Django

unread,
Jun 26, 2021, 5:09:52 AM6/26/21
to django-...@googlegroups.com
#32883: CORS issue with flutter web and django!
-------------------------------------+-------------------------------------
Reporter: dev-akshat | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: 3.1
Severity: Normal | Resolution:
Keywords: CORS , flutter , | Triage Stage:
django_rest_framework , | Unreviewed

flutter_web , response , request |
, rest api , json |
Has patch: 0 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by dev-akshat):

* cc: dev-akshat (added)
* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32883#comment:1>

Django

unread,
Jun 26, 2021, 9:51:50 AM6/26/21
to django-...@googlegroups.com
#32883: CORS issue with flutter web and django!
-------------------------------------+-------------------------------------
Reporter: Akshat Tamrakar | Owner: nobody
Type: Bug | Status: closed

Component: HTTP handling | Version: 3.1
Severity: Normal | Resolution: invalid

Keywords: CORS , flutter , | Triage Stage:
django_rest_framework , | Unreviewed
flutter_web , response , request |
, rest api , json |
Has patch: 0 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


Comment:

This looks like a usage question. See
TicketClosingReasons/UseSupportChannels for other ways to get help. If you
can explain why Django is at fault, feel free to reopen with an
explanation.

--
Ticket URL: <https://code.djangoproject.com/ticket/32883#comment:2>

Reply all
Reply to author
Forward
0 new messages