Skip to content

Instantly share code, notes, and snippets.

@andete
Created January 15, 2014 18:30
Show Gist options
  • Save andete/8441645 to your computer and use it in GitHub Desktop.
Save andete/8441645 to your computer and use it in GitHub Desktop.
simple (future partial) http proxy in node.js
http = require 'http'
url = require 'url'
http_proxy = require 'http-proxy'
proxy = new http_proxy.RoutingProxy()
http.createServer (req, res) ->
console.log 'Incoming Request from: ' +
req.connection.remoteAddress +
' for href: ' + (url.parse req.url).href
proxy.proxyRequest req, res, {
host: '192.168.1.100',
port: 80
}
.listen 4000
console.log 'Server running at http://127.0.0.1:4000/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment