Ionic run livereload CORS not working

If I do ionic run android (runs on a real device) I can make REST calls to my API.

But if I do ionic run android -l I cant make REST calls due to CORS (Getting Origin http://10.90.25.108:8100 is not allowed by Access-Control-Allow-Origin)

Why cant I make CORS with livereload? :frowning:

shameful bump. :smiley: :smiley: :smiley:

Well you could disable CORS for testing if you wanted

$http.defaults.useXDomain = true;
1 Like

I apologize in advance for bumping an old thread, but can you elaborate on this a bit? I’ve been wresting with this one and it seems to be a sticking point for quite a few devs who are developing the API on the same machine that they’re running the ‘run -l’ command from - https://github.com/driftyco/ionic-cli/issues/89

This is also a documented sticking point elsewhere: http://stackoverflow.com/questions/25345773/cors-issue-with-phonegap-angular-app-and-rails , http://ionicinaction.com/how-to-fix-cors-issues-revisited/ , Ionic CLI livereload and CORS , CORS issue with ionic emulate , and others…

I’ve attempted to add the ‘useXDomain = true’ as suggested, but this doesn’t work around the issue for me as the CORS error still occurs with this in place.

I’ve also tried the proxy approach, but the issue persists when developing an api local to the machine that you’re running live reload on…

Running without live reload works fine, but of course that’s a client actually communicating over the LAN rather than locally to the development server.

Do you know of an easy way to use live reload while developing an API and an Ionic app on the same machine?

Thanks.