Commit 4d509153 authored by Max Ogden's avatar Max Ogden

change proxytable routing to route one level shallower

parent f188f4ff
......@@ -101,7 +101,8 @@ ProxyTable.prototype.setRoutes = function (router) {
self.routes.push({
route: route,
target: router[path]
target: router[path],
path: path
});
});
}
......@@ -138,6 +139,14 @@ ProxyTable.prototype.getProxyLocation = function (req) {
match;
if (match = target.match(route.route)) {
var root = "/" + route.path.split('/')[1];
var beginningSegment = new RegExp("^" + root);
if(req.url.match(beginningSegment)) {
req.url = req.url.replace(beginningSegment, '');
}
var location = route.target.split(':'),
host = location[0],
port = location.length === 1 ? 80 : location[1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment