Skip to content

Instantly share code, notes, and snippets.

@robdodson
Created October 17, 2012 22:07
Show Gist options
  • Select an option

  • Save robdodson/3908630 to your computer and use it in GitHub Desktop.

Select an option

Save robdodson/3908630 to your computer and use it in GitHub Desktop.
proxy
httpProxy.createServer(function(req,res,proxy) {
if (req.url.match(/\/data/)) {
console.log('data');
proxy.proxyRequest(req, res, {
host: config.DATA_APP_HOST,
port: config.DATA_APP_PORT
});
} else if (req.url.match(/\/wordpress/)) {
console.log('wordpress');
proxy.proxyRequest(req, res, {
host: config.WORDPRESS_HOST,
port: config.WORDPRESS_PORT,
});
} else {
console.log('web');
proxy.proxyRequest(req, res, {
host: config.WEB_APP_HOST,
port: config.WEB_APP_PORT
});
}
}).listen(config.PROXY_PORT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment