I have a Java service running on my main OS(Windows7 Pro.) and I can access it throu broswer at http://localhost:8080/...
. It returns valid JSON reposnse.
I also have a SPA written in angularjs
, that is located on my virtual machine where I created a Virtual-Host for it(for more comfortable access). Virtual machine OS is Ubuntu Server 12.04.X LTS.
Since those environments are in network terms separated from each other, I was trying to access Java service through my local machine IP address X.X.X.X:8080
(pinging through terminal did send response). Since normal $http
usage didn't work I tried solution suggested in this answer How to load a cross-domain JSON with $http in angularjs 1.0.8 as it does with 1.2.0, but either it is too old or something else is wrong, but when I try to do same it just doesn't work. In console I see only following
XMLHttpRequest cannot load http://X.X.X.X:8080/library/api/books. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dev.xxx' is therefore not allowed access.