You're viewing a comment by Eric Stob and its responses.

Eric Stob Permalink
February 24, 2012, 19:22

Coffee version = 11 lines

http = require 'http'
http.createServer (request, response) ->
  proxy = http.createClient 80, request.headers['host']
  proxy_request = proxy.request request.method, request.url, request.headers
  proxy_request.addListener 'response', (proxy_response) ->
    proxy_response.addListener 'data', (chunk) -> response.write chunk, 'binary'
    proxy_response.addListener 'end', response.end
    response.writeHead proxy_response.statusCode, proxy_response.headers;
  request.addListener 'data', (chunk) -> proxy_request.write chunk, 'binary'
  request.addListener 'end', proxy_request.end
.listen 8080

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 "quake3_215": (just to make sure you're a human)

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