Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Routing infinite loop

Started by Pierre Declémy 6 years ago · 4 replies · 463 views
6 years ago

Hello,
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

last edited 01/05/20 by Pierre Declémy
6 years ago

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:

https://github.com/getgrav/grav/issues/2080

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

6 years ago

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

last edited 01/06/20 by Pierre Declémy
6 years ago

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 🤔

6 years ago

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

Hope it helps !

Thank you

Suggested topics

Topic Participants Replies Views Activity
Support · by Water Science, 3 weeks ago
11 152 45 minutes ago
Support · by Duc , 16 hours ago
1 42 16 hours ago
Support · by Thomas, 1 week ago
3 115 1 day ago
Support · by Anna, 4 days ago
2 105 2 days ago
Support · by Justin Young, 2 days ago
1 82 2 days ago