Issue
I have an application running on a tomcat 8 server, on a domain and an Angular web app. The web app uses the tomcat application, but without enabling filtering in the web.xml the webapp will mention problems.
Here is how I make the js requests to the tomcat application
function getResources($http, url){
return $http({
method: 'GET',
url: url,
headers: {'Accept': 'application/json'}
}).then(function (result) {
return result.data;
});
};
I've also tried with : dataType: 'jsonp'
The error looks like:
XMLHttpRequest cannot load http://localhost:8080/APP/requestStuff.No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.
Which is strange to me, because if the origin is the same as where I am connected it shouldn't be cross origin.
Solution
cross origin request policy applies any time the scheme (e.g. http vs https), domain, or ports vary. So in your case because the ports differ you will need CORS.
Answered By - zayquan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.