Created
March 15, 2017 21:35
-
-
Save mezod/82ac5d6794c0d2248d7e5d4dfae2f3ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
var proxy = httpProxy.createProxyServer({}); | |
var server = http.createServer(function(req, res) { | |
var host = req.headers.host; | |
var url; | |
console.log(host); | |
if (!host) return; | |
if (host.indexOf('eventradr') !== -1) url = 'http://localhost:8080'; | |
if (host.indexOf('listlogs') !== -1) url = 'http://localhost:8081'; | |
if (host.indexOf('dodecathlon') !== -1) url = 'http://localhost:8082'; | |
if (host.indexOf('everydaycheck') !== -1) url = 'http://localhost:8084'; | |
if (host.indexOf('app.everydaycheck') !== -1) url = 'http://localhost:8083'; | |
console.log(url); | |
if (url)proxy.web(req, res, { | |
target: url | |
}); | |
}); | |
console.log("listening on port 80") | |
server.listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment