【发布时间】:2015-11-23 17:52:19
【问题描述】:
我有一个在 tomcat 8 服务器上运行的应用程序,在域上 和一个 Angular 网络应用程序。 web 应用使用 tomcat 应用,但是在 web.xml 中不启用过滤,webapp 会提到问题。
这是我向 tomcat 应用程序发出 js 请求的方式
function getResources($http, url){
return $http({
method: 'GET',
url: url,
headers: {'Accept': 'application/json'}
}).then(function (result) {
return result.data;
});
};
我也尝试过:dataType: 'jsonp'
错误看起来像:
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.
这对我来说很奇怪,因为如果原点与我连接的位置相同,则它不应该是交叉原点。
【问题讨论】:
标签: java angularjs tomcat cors