I gave this talk to the RomaJS community in april 2014. Slides available at https://speakerdeck.com/marcoloche/relaxing-the-same-origin-policy
npm install
Add following lines to your hosts file
In *NIX system /etc/hosts
:
127.0.0.1 www.site1.local
127.0.0.1 store.site1.local
127.0.0.1 api.site2.local
node app
Open in your browser and go to the index page
http://www.site1.local:3000/
Using the console of your favourite broweser take a look what's going on under the hood and pay particular attention to the HTTP Headers of requests and responses.
http://www.site1.local:3000/unrelaxed.html
http://www.site1.local:3000/relaxed.domain.html
http://www.site1.local:3000/relaxed.message.html
http://www.site1.local:3000/relaxed.jsonp.html
http://www.site1.local:3000/relaxed.cors.html