diff --git a/lib/node-http-proxy/proxy-table.js b/lib/node-http-proxy/proxy-table.js index 0cdce50a5..9035ab8da 100644 --- a/lib/node-http-proxy/proxy-table.js +++ b/lib/node-http-proxy/proxy-table.js @@ -97,7 +97,7 @@ ProxyTable.prototype.setRoutes = function (router) { this.routes = []; Object.keys(router).forEach(function (path) { - var route = new RegExp(path, 'i'); + var route = new RegExp('^' + path, 'i'); self.routes.push({ route: route, @@ -137,7 +137,6 @@ ProxyTable.prototype.getProxyLocation = function (req) { for (var i in this.routes) { var route = this.routes[i]; if (target.match(route.route)) { - var pathSegments = route.path.split('/'); if (pathSegments.length > 1) {