diff --git a/plugins/dispatcher/dispatcher.js b/plugins/dispatcher/dispatcher.js index 24abbca..75ecc79 100644 --- a/plugins/dispatcher/dispatcher.js +++ b/plugins/dispatcher/dispatcher.js @@ -62,6 +62,7 @@ module.exports = function (options) { debuglog('actually get router [%s]', router.__name__); if (router.__name__ === routerName && req.params.router && shiftRouterNameFromUrl) { req.url = shiftUrl(req.url); + req.baseUrl = (req.baseUrl || '') + '/' + routerName; debuglog('router is matched, remove router from url [%s]', req.url); } debuglog('[%s] lookup for user defined router', req.url); @@ -93,6 +94,7 @@ module.exports = function (options) { debuglog('actually get action [%s]', action.__name__); if (action.__name__ === actionName && req.params.action && shiftRouterNameFromUrl) { req.url = shiftUrl(req.url); + req.baseUrl = (req.baseUrl || '') + '/' + actionName; debuglog('action is matched, remove action from url [%s]', req.url); } action(req, res, next);