I'm trying to read a remote RSS feed and getting the follwing error message:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://*.*.*.*' is therefore not allowed access.
Can anyone tell me how to enable CORS so I can resolve this issue - particularly if I don't have admin access to the remote resource?
I'm trying to read a remote RSS feed and getting the follwing error message:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://*.*.*.*' is therefore not allowed access.
Can anyone tell me how to enable CORS so I can resolve this issue - particularly if I don't have admin access to the remote resource?
Share Improve this question asked Feb 9, 2014 at 7:50 siskosisko 9,94020 gold badges74 silver badges142 bronze badges 3- What host provider you are using? I think you need to add that header settings into Apache/IIS. – Panu Oksala Commented Feb 9, 2014 at 7:54
- 1 CORS is a mechanism for the owner of a resource to allow other origins to access it. If you don't own the resource, you can't enable CORS. You can set up a proxy server that fetches the resource and delivers it to the browser on an allowed origin. – apsillers Commented Feb 9, 2014 at 7:57
- possible duplicate of Access Control Allow Origin not allowed by – Ray Nicholus Commented Feb 9, 2014 at 14:16
2 Answers
Reset to default 3It's up to the remote resource to allow cross-origin resource sharing. The response needs to have a header that specifies that access can e from your domain. Something like:
Access-Control-Allow-Origin: http://xyz.example.
needs to be present in the response headers.
Without control over what the remote site, there's not much you can do to enable CORS to that site (other than contacting the site administrator).
Other CORS headers and how the entire scheme works is described here (among other places).
Seems like a cross domain request issue. Would you consider just using a middle scrit as a proxy workaround? Then make your javascript request to a php file that grabs the data for and feeds it back such as
<?php
$url = 'http://getmethedatafromyourapi';
header('Content-Type:text/json');
echo file_get_contents($url);