I need to access a json file located on a different server (with angular). Naturally I would get a No Access-Control-Allow-Origin.
These are the solution I have tried
Placing an .htaccess in the folder where the file is located with.
<IfModule mod_headers.c>
<Directory /var/www/app/json>
<FilesMatch "\.(json|jsonp)$">
Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Credentials true
<FilesMatch>
</Directory>
</IfModule>
The javascript looks like this.
var json = $resource(url,{},{"get":
{
"isArray":false,
"cache":false,
"responseType":"json",
"withCredentials":true,
"headers":{"Access-control-Allow-Origin":"*",'Content-Type': 'application/json'}
}
});
json.get(function(data){
console.log(data);
});
My issue is similar to this but it has not helped me.