I've got a Meteor app that has been working fine. When deploying to iOS or Android, it still works fine. But, when deploying to localhost, I now suddenly encounter this console error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at {{external json resource}}. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘http://localhost:12616’).
What I find eyebrow-raising is that my app, when running on localhost, runs on port 3000.
The app picks up external data from a Wordpress installation, using the Wordpress API. In that Wordpress installation I've got the following:
function add_cors_http_header(){
header("Access-Control-Allow-Origin: *");
}
add_action('init','add_cors_http_header');
How to resolve this?
I'm on Meteor 1.8.1.