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 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 -

This is also a documented sticking point elsewhere: , , 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?