Created
January 15, 2014 18:30
-
-
Save andete/8441645 to your computer and use it in GitHub Desktop.
simple (future partial) http proxy in node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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