CORS issue with flutter web and django rest framework! #8061
Unanswered
dev-akshat
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
Beta Was this translation helpful? Give feedback.
All reactions