[SOLVED] CORS with Ionic

Here’s a tips:

  1. download chrome canary (like chrome beta)
  2. open terminal and do:
  3. nano ~/.bash_profile
  4. navigate to a new line and add: alias corsdev=’open -n -a /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --args --disable-web-security’
  5. ctrl-o (saves the file)
  6. enter
  7. ctrl-x
  8. restart the terminal

Now if you open terminal and do corsdev it will open Chrome Canary with the disable-web-security-flag and you’ll be able to do cross origin requests (cors)!

You could of course do this with the ordinary chrome, but if you disable web-security it becomes unsafe, so it might not be so wise…
I instad use Canary for dev and do my googling safely in the ordinary chrome.

(anyone know a way of open a new instance of chrome? then you wont need canary)

1 Like