Error in route parameter that contains dot

I have a module that queries data from a Kubernetes cluster. The pods have dots in their names, like “ldap-ndb-df-p.1”. I created a route of type Segment where there is a parameter pod. The router doesn’t match when pod name has a dot. Below it is the route definition. I have added a regex in constraints that matches a text with dot, but it doesn’t work.

'pod-route' => [
                'type'    => Segment::class,
                'options' => [
                    'route'    => '/cluster[/:action[/:namespace[/:pod]]]',
                    'constraints' => [
                        'pod' => '[a-zA-Z][a-zA-Z0-9_-]+[\.]+[a-zA-Z0-9_-]+'
                    ],
                    'defaults' => [
                        'controller' => Controller\IndexController::class,
                        'action'     => 'index',
                    ],
                ],
            ],  

This route works only for parameters action and namespace.
I also have tried to use a route of type Regex, using the same expression in contraints above but it also doesn’t match.

I didn’t find in documentation about routing a guideline about exception treatment for routes. I need to know how I can express properly a route parameter with a dot, or how I can treat the exception, capturing the route unmatched and checking if it has a parameter pod with dot.

1 Like

Looks like I have a similar problem.
Have you found a Solution to this problem, and if so would you mind posting it?

No, I had to make a workaround with a listener, testing the route with ‘pod’ before matching. It’s like an alternative router, but really It is ugly.

I got it working.

Turns out my php test environment wasn’t setup quite correct.
The 404 wasn’t from laminas.

php -t public/
Ignores htaccess and web.config and returns 404 for files.

php public/index.php
Works for files too.