[doc] added comments to pathnameOnly block.

This commit is contained in:
Mikkel Garcia 2013-03-05 17:57:03 -07:00 committed by indexzero
parent a1607c1684
commit 5e6be6ccf5

View File

@ -183,16 +183,25 @@ ProxyTable.prototype.getProxyLocation = function (req) {
else if (this.pathnameOnly === true) {
var target = req.url;
for (var i in this.routes) {
var route = this.routes[i];
if (target.match(route.source.regexp)) {
req.url = url.format(target.replace(route.source.regexp, ''));
return {
protocol: route.target.url.protocol.replace(':', ''),
host: route.target.url.hostname,
port: route.target.url.port
|| (this.target.https ? 443 : 80)
};
}
var route = this.routes[i];
//
// If we are matching pathname only, we remove the matched pattern.
//
// IE /wiki/heartbeat
// is redirected to
// /heartbeat
//
// for the route "/wiki" : "127.0.0.1:8020"
//
if (target.match(route.source.regexp)) {
req.url = url.format(target.replace(route.source.regexp, ''));
return {
protocol: route.target.url.protocol.replace(':', ''),
host: route.target.url.hostname,
port: route.target.url.port
|| (this.target.https ? 443 : 80)
};
}
}
}