Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/x.js Secret

Created August 22, 2012 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/cc0fefbeb5fa574a927f to your computer and use it in GitHub Desktop.
Save Raynos/cc0fefbeb5fa574a927f to your computer and use it in GitHub Desktop.
httpProxy.createServer(function (req, res, proxy) {
var host = req.headers.host
, subdomain = host.split(".")[0]
, port
if (subdomain === "streams") {
port = 4001
} else {
port = httpPort
}
proxy.proxyRequest(req, res, {
host: 'localhost',
port: port
})
}).listen(httpProxyPort)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment