node.js based CORS proxy

Recently I found that a WebGL program I wrote earlier was not working anymore due to CORS restriction. To get around this, I wrote up an extremely simple proxy using node.js and hosted it on the amazing nodester service.

You can access the service like this:

http://corsproxy.nodester.com/?src=<image url>

It just fetches the data from remote url and streams it back, after adding the following two headers:


Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With

You can see the source code here:

https://github.com/rmadhuram/corsproxy/blob/master/server.js

I tested it on Aurora (Firefox 9.0a2) and it works fine with a modified Three.js sample.
Note: Please use the nodester link for demonstration purposes only. Don’t use it in production!

Leave a Reply