uro6ka
Last Updated: February 25, 2016
·
7.519K
· g33konaut
D38ff2119d6ace825b4c7b64e6f422d8

CORSProxy - simple cross-origin AJAX for everything

Thanks to CORS cross origin AJAX has become pretty easy and painless.

But when I start playing around with APIs, I often find they don't set the headers and often they also don't provide a JSONP workaround.

Ignoring more painful options, that leaves the possibilities to use Yahoo Query Language or whip up your own custom proxy on some server using node.js, Ruby, PHP or whatever.

But there's another, even more comfortable option:

CORSProxy.com allows you to proxy every HTTP request you wish and gives you the response with the proper CORS header, so that your browser does not yell at you.

As an example, the Open Notify ISS Position API lacks both, JSONP (as far as I can tell) and CORS at the time of this writing.
Using CORSProxy, you can still get the data directly from the client side:

$.getJSON(" http://www.corsproxy.com/api.open-notify.org/iss-now/v1/", function(response) {
    console.log(response);
});

Painless, quick and easy.

Note: Don't use this for sensitive information. As long as you play around with publicly available data, fine. If you gonna use it for a production system, you will be smacked. If you have anything non-public or a "real live production" system, write your own little proxy for it. This method is supposed as a quick way to meddle with public APIs.

Say Thanks
Respond

3 Responses
Add your response

13235

The perfect solution! I was looking for something that would make that easy by adding the less code, but this solution is just the fastest I've ever found. Thanks for the share :) !

over 1 year ago ·
17927
0 ican ok0mspd 09mwnlw e93mv7ktybm5pli wv3l0uvs4kjba3zdd3f8nfsauqvoq1euabe mgx

Does corspoxy support POST?

over 1 year ago ·
17929
The one cropped

As far as I know, not :(

over 1 year ago ·