From f540fadac42d0258d39c994d578382dfeaab0968 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 1 Apr 2017 01:35:43 +0800 Subject: [PATCH] also check path matched req.url --- lib/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/router.js b/lib/router.js index 37107dbd..f28361c0 100644 --- a/lib/router.js +++ b/lib/router.js @@ -28,7 +28,7 @@ function getTargetFromProxyTable(req, table) { _.forIn(table, function(value, key) { if (containsPath(key)) { - if (hostAndPath.indexOf(key) > -1) { // match 'localhost:3000/api' + if (hostAndPath.indexOf(key) == 0 || path.indexOf(key) == 0) { // match 'localhost:3000/api' result = table[key]; logger.debug('[HPM] Router table match: "%s"', key); return false;