Cross-domain API

Zaid Abdulla zaid at genieacs.com
Sun Mar 13 19:06:52 EDT 2016


On Thu, 2016-03-10 at 10:53 -0500, Curtis Rabon wrote:
> I’m trying to use a jquery getJSON call on the API, and it is failing
> because of cross-domain errors. I have tried using JSONp but the API
> is not wrapping the query in a callback. I would prefer to just
> add res.header("Access-Control-Allow-Origin", "*”) and fill in my IP,
> but I do not know where to add the line at.

You can add that in every response.writeHead call in nbi.coffee. But I
would advise against exposing the API like that. Why not proxy these
requests through the server side of your app?

Zaid


More information about the Users mailing list