We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f188f4f commit 4d50915Copy full SHA for 4d50915
lib/node-http-proxy/proxy-table.js
@@ -101,7 +101,8 @@ ProxyTable.prototype.setRoutes = function (router) {
101
102
self.routes.push({
103
route: route,
104
- target: router[path]
+ target: router[path],
105
+ path: path
106
});
107
108
}
@@ -138,6 +139,14 @@ ProxyTable.prototype.getProxyLocation = function (req) {
138
139
match;
140
141
if (match = target.match(route.route)) {
142
+
143
+ var root = "/" + route.path.split('/')[1];
144
+ var beginningSegment = new RegExp("^" + root);
145
146
+ if(req.url.match(beginningSegment)) {
147
+ req.url = req.url.replace(beginningSegment, '');
148
+ }
149
150
var location = route.target.split(':'),
151
host = location[0],
152
port = location.length === 1 ? 80 : location[1];
0 commit comments