Cross-Origin Request Blocked



I am trying to access an API that is hosted on my C9 IDE instance. I am running a mobile webpage on another domain that calls the API. if I access the api url directly it works. but when the JS on the mobiel page calls it I get this error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

I have check the forums and the only suggestion has been to ensure that the url is shared as public. I have tried this but it is still not working



Hosting fonts in C9, cross-origin, access-control-allow-origin

you need to set correct CORS headers to allow that see

in node.js you could do something like

res.writeHead(200, {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "PUT, GET, OPTIONS, HEAD"