Closed
Description
This is a (multiple allowed):
-
bug
-
enhancement
-
feature-discussion (RFC)
-
CakePHP Version: 3.5.11
What you did
Tried to handle three different domains under the same application frontend/backend/api and configured the routes
What happened
In the documentation it says that this can be done by using the _host or ->setHost
I had many repeated $routes->connect()->setHost() , one for every route
What you expected to happen
It would be better to suggest setting this parameter globally on the scopes, so there will be one scope for every domain. It would be more clean
Edit: it doesn't work as it always pick the first / scope, it should pick the one associated to the host
Example
<?php
Router::scope('/', [ '_host' => 'subdomain1.domain.com' ], function (RouteBuilder $routes) {
});
Router::scope('/', [ '_host' => 'subdomain2.domain.com' ], function (RouteBuilder $routes) {
});
Router::scope('/', [ '_host' => 'subdomain3.domain.com' ], function (RouteBuilder $routes) {
});