12 lines proxy with Node.js and Request

Easy and simple http proxy using Node.js and request.

var request = require('request')
  , http = require('http')
  , port = 8888
  , host = 'localhost'
  , proxy = http.createServer(function (req, res) {
    var x = request(req.url)
    req.pipe(x)
    x.pipe(res)
  })
proxy.listen(port, host, function () {
  console.log('Proxy running on port ' + port);
})

Code available on Github: node-simple-proxy.

It would be great to support https. And of course, you can do it without request.