Skip to content

Commit

Permalink
Needed the header object to get host
Browse files Browse the repository at this point in the history
  • Loading branch information
godsflaw committed Dec 12, 2013
1 parent b66839a commit fa2a5c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/resist_config.js
Expand Up @@ -28,7 +28,7 @@ function ResistConfig(opt, listenCallback) {
}
});

this.gossip.on('update', function(peer, key, value) {
this.gossip.on('update', function (peer, key, value) {
if (key !== '__heartbeat__') {
var data = self.resistCrypt.decrypt(peer, key, value);

Expand All @@ -50,8 +50,8 @@ ResistConfig.prototype.getHost = function (host) {
baseHost = this.hostResistConfig[host].alias;
}

if (this.hostResistConfig[host]) {
return this.hostResistConfig[host];
if (this.hostResistConfig[baseHost]) {
return this.hostResistConfig[baseHost];
} else {
return this.hostResistConfig["__default__"];
}
Expand Down
11 changes: 5 additions & 6 deletions lib/resist_server.js
Expand Up @@ -143,14 +143,13 @@ function ResistServer(options) {
};

res.on('finish', setCache);

var proxyOptions = {
host : self.config.getHost(req.host).proxy_host,
port : self.config.getHost(req.host).proxy_port,
maxSockets : self.config.getHost(req.host).proxy_sockets,
host : self.config.getHost(req.headers.host).proxy_host,
port : self.config.getHost(req.headers.host).proxy_port,
maxSockets : self.config.getHost(req.headers.host).proxy_sockets,
buffer : reqBuffer,
enable : {
xforward : self.config.getHost(req.host).proxy_xforward
xforward : self.config.getHost(req.headers.host).proxy_xforward
}
};

Expand All @@ -168,7 +167,7 @@ function ResistServer(options) {
if (req.hasStaleResult) {
req.resistTimeoutID = setTimeout(
self.proxyTimeout,
self.config.getHost(req.host).proxy_timeout,
self.config.getHost(req.headers.host).proxy_timeout,
req,
res
);
Expand Down

0 comments on commit fa2a5c7

Please sign in to comment.