You're replying to a comment by Leonardo Veríssimo.

Leonardo Veríssimo Permalink
October 25, 2012, 13:09

This proxy is using an old version of Node. Today, I needed a simple proxy, like yours, and using the latest version (0.8.12), a new proxy could be written this way:

var http = require('http');

http.createServer(function(request, response) {
	var proxyRequest = http.request({
		host: request.headers['host'],
		port: 80,
		path: request.url,
		method: request.method,
		headers: request.headers
	}, function(proxyResponse) {
		response.writeHead(proxyResponse.statusCode, proxyResponse.headers);
		proxyResponse.pipe(response);
	});
	request.pipe(proxyRequest);	
}).listen(8080);

Just 14 lines!

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "server_215": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.