I've a custom module where I have create the following route:
my.custom.route:
path: /{someVariable}/my-module/test
defaults:
_controller: '\Drupal\my_module\Controller\myController::build'
requirements:
_permission: 'access content'
On the controller I've the following code
public function build($someVariable)
{
echo 'here';
dump($someVariable);
exit;
When I go to /devel/routes the route is there with the name I see all details of the route
when I call the path function it generates the route as expected, but when I go to the page just throw a 404 response instead give me the expected output.
if I change the path to have the variable in any other position apart of the first part of the url it works as expect
I'm working with Drupal 9.3.2
Thanks