I’m currently faced with a problem. Within my application I make HTTP requests to an external API which I have white listed within my
config.xml file. Now on the phone, the requests are made and the JSON is returned. However, when on Chrome (w/
ionic serve) I cannot make these requets due to CORS.
Coming from a PHP Framework background, you’d get around something like this by settings an environment variable on the server and then the application can detect if it’s production or local, and from there create a separate task. If this were the case, I could create a local proxy server which completes the request with cURL (or something), and get my local environment (Chrome) to send the requests to that (no cross domain involved then).
This is all well and good, but how can I detect between local (Chrome via
ionic serve) and it being production (built onto a mobile device).