[PDB Tech] Access-Control-Allow-Origin

Ruairi Carroll ruairi.carroll at gmail.com
Thu Jan 12 06:41:09 PST 2017


Hey Martin,

Thanks for bringing this to my attention - useful !

However my original question still stands: Should we be hitting
api.peeringdb.com directly, or hosting our own installs for any apps we
develop?

Cheers
/Ruairi

On 11 January 2017 at 20:16, Martin J. Levy <mahtin at mahtin.com> wrote:

> This is a JSONP issue (well worth a search on stackoverflow). Once you
> master that there are no XSS errors. I also means you don't need the server
> to enabled "allow origin". I had some code that works as-is.
>
>       var url = peeringdb_api_url + '/' + $scope.getJSONParam1 + '/' +
> $scope.getJSONParam2;
>       url = url + '?callback=JSON_CALLBACK';
>       console.log('url = "' + url + '"');
>       $http.jsonp(url, config)
>         .then(function successCallback(response) {
>           console.log('successCallback() called');
>           $scope.getCallJSONResult = logResult("GET SUCCESS",
> response.data, response.status, response.statusText, response.headers,
> response.config);
>         }, function errorCallback(response) {
>           console.log('errorCallback() called');
>           $scope.getCallJSONResult = logResult("GET ERROR",
> response.data, response.status, response.statusText, response.headers,
> response.config);
>         });
>     };
>
> This is in Angular - but that's a whole other conversation.
>
> Try that.
>
> Martin
>
> On Wed, Jan 11, 2017 at 11:00 AM, Ruairi Carroll <ruairi.carroll at gmail.com
> > wrote:
>
>> Hey,
>>
>> While writing a JS app, I noticed that Access-Control-Allow-Origin is not
>> set on api.peeringdb.com.  I also see that there's an open issue for
>> this ( https://github.com/peeringdb/peeringdb/issues/78 ).
>>
>> I was wondering what would be the best way to do this - should I sync and
>> host my own copy of the API, or are you OK with having random calls to the
>> API from webapps?
>>
>> /Ruairi
>>
>> _______________________________________________
>> Pdb-tech mailing list
>> Pdb-tech at lists.peeringdb.com
>> http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.peeringdb.com/pipermail/pdb-tech/attachments/20170112/d1f1bf34/attachment.html>


More information about the Pdb-tech mailing list