Search code examples
angularjsdjangocordovacorsdjango-cors-headers

CORS Issue with django, cordova, ionic and angular.js


I use the django cors headers plugin to handle all my issues with cross origin access.

We implement a webapp with angular, cordova and ionic which should get access to an endpoint of the django backend.

The backend is running on a debian server and I set CORS_ORIGIN_WHITELIST to ("our_web_dev_server_ip", "our_web_prod_server_ip").

When I try to call a get to my endpoint from localhost it gives me a cross origin error.

If I set CORS_ORIGIN_ALLOW_ALL to True it works flawlessly. When I check my django logs, I can see, that the request IP was the IP of the web dev server.

So why is the request failing when I added this ip to the whitelist in the settings? Any ideas?


Solution

  • The issue was the Webstorm Integrated Server which served the client on localhost and standard port 63342.

    Just added localhost:63342 to CORS_ORIGIN_WHITELIST and now it works.