[Django]-How do you remove the "XMLHttpRequest error" in Flutter? (Django backend, Flutter frontend)

2πŸ‘

βœ…

It might be caused because CORS is not enabled in your backend. It happens because your server and frontend are present on different IPs (Even if you are doing your work on localhost, the port is still different).

To solve this you you just have to add parameters to enable CORS in your response header. There are packages available for that acts as a middleware so you wont have to add it in every response. Refer the below question :

How can I enable CORS on Django REST Framework

πŸ‘€Sarvesh Dalvi

Leave a comment