ADI-Labs / density

wireless density API
13 stars 26 forks source link

Implement CORS for JavaScript API Consumers #176

Open schlosser opened 8 years ago

schlosser commented 8 years ago

We need to implement CORS on our API. It may involve having users input their JavaScript origins. (the URL).

Sent to our email:

""" I am currently building a website that makes use of your new density API. As I'm sure you can guess, the main component involves an AJAX request to one of your endpoints to fetch some JSON.

In both Chrome and Safari, I have run into the following issue: XMLHttpRequest cannot load URL. Origin is not allowed by Access-Control-Allow-Origin.

Not surprising as cross-domain requests have always been problematic from a security standpoint. However, in line with the Cross-Origin Resource Sharing mechanism, you can safely allow other domains to access your data. Can you please set your Access-Control-Allow-Origin headers to "*" in the response so that I can access this data?

Thanks! """