Routing infinite loop

I am facing some routing issues here, but i’m not sure if i am doing this properly

For some reason I need urls like “/foo/some-slug” to point to “/foo/bar:some-slug”
So I wrote this rule :
routes: '/foo/(?!.*:)([a-z0-9]+(?:-[a-z0-9]+)*)': '/foo/bar:$1'

But this triggers an infinite loop. What am I doing wrong here ? This only happens when an url parameter is present.

Thank you in advance

What kind of web server are you running and how do you know it’s triggering an infinite loop? (seeing a timeout, for example)

I haven’t tested if this bug is still in a recent Grav version. Perhaps see if it’s similar to what you are experiencing:

Please add your comment to the issue if it is. This bug has existed for a long time.

It doesn’t seem to be related to the server. The final error is indeed a timeout, the $this->dispatch() function from Pages.php is perpetually called with the same args.
The post you linked is exactly the issue i have. Thank you for linking this to me, i’m sorry I didn’t find this before posting despite my research.
I will get in touch with this post if a solution or a workaround is provided.

Thank you

Would you mind adding to that issue that you are also experiencing this problem? It needs attention if it is still unfixed. You could link to this forum post.

I am going to try to remember to set up a dockerised Grav container, so that I can test it is still in the latest version, and the maintainers can reproduce more easily.

I’ve stared at that Page.php code for hours. There are undocumented and misleadingly named variables and methods that make it very hard to figure out. I didn’t find an effective way to trap the error either :thinking:

Yes no problem. I posted an answer with a workaround solution.

Hope it helps !

Thank you