I am using angular $ http. Please find the code below.
$http({
url: ' http://xxx.yyy.zzz:8080/..../sponsors',
method: 'GET',
headers: { 'Token' : 'abc' }
}).success(function(sponsors){
$scope.sponsorList = sponsors;
}).error(function(sponsors){
alert('failed to get sponsors')
});
I get the error below
"The response to the preliminary check request does not pass the access control check: the header" Access-Control-Allow-Origin "is present on the requested resource.
Reliable web services are deployed on Tomcat-8.
I added a CORS filter to tomcat / conf / web.xml as shown below.
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Even if I get the same error.
Can someone please help me how to fix this? Am I missing any client side headers? What else needs to be done on the server side?
Thank you in advance