Skip to content
xna2 edited this page Jun 18, 2012 · 3 revisions

make a file called proxy.js

var http = require('http');

var server = http.createServer();

server.on("request", function () {

    var proxyRequest = http.request({
        host:request.headers['host'],
        path:request.url(),
        method:request.method,
        headers: request.headers

    }, function(proxyResponse){
        reponse.writeHead(proxyResponse.statusCode, proxyResponse.headers);
        proxyResponse.pipe(response);
    });

    request.pipe(proxyRequest);

})


server.listen(8080);

Clone this wiki locally