Open
Description
Hi everyone
What I did
$routes->scope('/{org}', ['plugin' => $this->getName(), '_host' => 'example.com'], function ($routes) {
$routes->connect('/', ['controller' => 'Orgs', 'action' => 'show'], ['pass' => ['org']]);
$routes->connect('/contact', ['controller' => 'Orgs', 'action' => 'contact'], ['pass' => ['org']]);
// ... other routes
});
What I expected to happen
All routes in this scope are connected only to example.com
What actually happened
All routes in this scope are available under the main application domain too
Workaround
$routes->scope('/{org}', ['plugin' => $this->getName()], function ($routes) {
$routes->connect('/', ['controller' => 'Orgs', 'action' => 'show'], ['pass' => ['org'], '_host' => 'example.com']);
$routes->connect('/contact', ['controller' => 'Orgs', 'action' => 'contact'], ['pass' => ['org'], '_host' => 'example.com']);
// ... other routes
});
This gets the job done but is not DRY
Related
- Ability to set route to full inside named configuration #17971
- Ability to set
_https
inside named configuration #18019
CakePHP Version
5.1.2