Skip to content

Instantly share code, notes, and snippets.

@matthewp
Created September 30, 2014 01:36
Show Gist options
  • Save matthewp/ec09a03643bf3f429753 to your computer and use it in GitHub Desktop.
Save matthewp/ec09a03643bf3f429753 to your computer and use it in GitHub Desktop.
Simple proxy in node
var httpProxy = require('http-proxy');
var http = require('http');
var proxy = httpProxy.createProxyServer({});
var server = http.createServer(function(req, res) {
var url = req.url;
console.log(url);
proxy.web(req, res, { target: url });
});
server.listen(9000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment