Fixed the bug with custom routes in views with middlewares.