Zend hostname route doesn't match when it has child routes
- by talisker
I am implementing an Admin module, which contains the following routes:
'router' => array(
'routes' => array(
'admin' => array(
'type' => 'Zend\Mvc\Router\Http\Hostname',
'options' => array(
'route' => ':subdomain.mydomain.local',
'constraints' => array(
'subdomain' => 'admin',
),
'defaults' => array(
'module' => '__NAMESPACE__',
'controller' => 'Admin\Controller\Index',
'action' => 'index',
),
),
'priority' => 9000,
'may_terminate' => true,
'child_routes' => array(
'users' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/users',
'defaults' => array(
'module' => '__NAMESPACE__',
'controller' => 'Admin\Controller\Users',
'action' => 'index',
),
),
),
)
),
),
),
And this is the home route configuration:
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
When I try to access to http://admin.mydomain.com, the route match always with the homeroute, but if I remove all the child routes from the admin route, the behavior is correct and a http://admin.mydomain.com matches with the adminroute. Any idea?