I get those errors after upgrade from Cake 3.7 to Cake 4.3.
(It worked without any issues on 3.7 and all other routings except this work well)
Cake\Routing\Exception\MissingRouteException: A route matching "array (
'controller' => 'Actions',
'action' => 'addAction',
0 => '12412412415125',
1 => '',
'_scheme' => 'https',
'plugin' => NULL,
'_ext' => NULL,
'_host' => NULL,
)" could not be found.
Undefined index: _host
In [...vendor/cakephp/cakephp/src/Routing/Router.php, line 493]
I have function to build url:
public static function buildUrl($action_name, $params = null) {
$routerOptions = [
'_full' => true,
'_ssl' => true,
"controller" => "Actions",
"action" => $action_name,
];
if (!empty($params) && is_array($params)) {
$routerOptions = array_merge($routerOptions, $params);
}
return Router::url($routerOptions);
}
In Application.php RoutingMiddleware is added:
public function middleware($middlewareQueue): MiddlewareQueue
{
$middlewareQueue
// Catch any exceptions in the lower layers,
// and make an error page/response
->add(new ErrorHandlerMiddleware(Configure::read('Error')))
// Handle plugin/theme assets like CakePHP normally does.
->add(new AssetMiddleware([
'cacheTime' => Configure::read('Asset.cacheTime'),
]))
// Add routing middleware.
// If you have a large number of routes connected, turning on routes
// caching in production could improve performance. For that when
// creating the middleware instance specify the cache config name by
// using it's second constructor argument:
// `new RoutingMiddleware($this, '_cake_routes_')`
->add(new RoutingMiddleware($this))
->add(new BodyParserMiddleware());
return $middlewareQueue;
}