diff --git a/new_forker.js b/new_forker.js index e7ffb16..6e3c8ae 100644 --- a/new_forker.js +++ b/new_forker.js @@ -5,12 +5,11 @@ httpProxy = require('http-proxy'); vhost = require('vhost'); require("sleepless") -cfg = require("./config.json") - -function webProxy(proxy) { return proxy.web.bind(proxy); } +webProxy = function(proxy) { return proxy.web.bind(proxy); } +cfg = require("./config.json") -var vhost_app = express(); +vhost_app = express(); for(var host in cfg.forks) { @@ -24,12 +23,11 @@ for(var host in cfg.forks) { xfwd: true, // add x-forwarded-for header so we get the real IP }); - vhost_app.use(vhost( host, webProxy(prox))); + vhost_app.use(vhost(host, webProxy(prox))); log("added fork: "+host+" -> "+tgt_host+":"+tgt_port); } - var server = http.createServer(function (req, res) { if (!req.headers.host && req.url.indexOf('://') !== -1) { res.writeHead(500)