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) { ...@@ -101,7 +101,8 @@ ProxyTable.prototype.setRoutes = function (router) {
self.routes.push({ self.routes.push({
route: route, route: route,
target: router[path] target: router[path],
path: path
}); });
}); });
} }
...@@ -138,6 +139,14 @@ ProxyTable.prototype.getProxyLocation = function (req) { ...@@ -138,6 +139,14 @@ ProxyTable.prototype.getProxyLocation = function (req) {
match; match;
if (match = target.match(route.route)) { 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(':'), var location = route.target.split(':'),
host = location[0], host = location[0],
port = location.length === 1 ? 80 : location[1]; 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