Local development and Same-origin policy
If you are a developer you probably have encountered an error like the following:
XMLHttpRequest cannot load http://something.tld/api/fetch/something. Origin http://local.dev is not allowed by Access-Control-Allow-Origin.
The problem is you are trying to fetch data through Ajax from a host that is not allowing that. For security reasons this makes a lot of sense but if you are a developer you just might want to try out those requests anyway.
Let’s say you are trying to communicate with an API and you will deploy to that server but at the moment you are developing locally and just want to try out things.
Tadaaa, Google Chrome to the rescue:
open /Applications/Google\ Chrome.app --args --disable-web-security
Paste this into your Terminal on OSX, hit enter and it opens Chrome with the Same-origin policy disabled. I’m sure you can pass the argument
--disable-web-security on other operating sytstems as well.
Hope this helps,