Option to enable Router path termination


I briefly discussed this on Slack with Gavin, but wanted to log it here for discussion.

Currently, it appears that if a portion of the URL path is matched by a route, the router will use it, even if the URL path continues, and the remaining portion does not match the route. That's probably a bit confusing - here's an example.

I've set up the following route to handle requests to /echo/index.

While it handles those correctly, it will also route requests to /echo/index/bogus to the echo.index handler. The bogus path is automatically interpreted to be part of a key-value pair, as if I were trying to pass it to my handler (in the manner of SEO rewrites, as Gavin put it).

Being new to ColdBox, this was unexpected. I didn't include a wildcard or pattern at the end of the route, so I expected the route to end there. If I had wanted to include bogus=foo, I would have added /:bogus to the end of the route. As far as I can tell, there's no framework based way to disable this functionality and terminate the route with the path I've provided.

Now, I know this is complicated, because modules (and perhaps namespaces?) can introduce a degree of nesting that is necessary - such as /api/v1/echo/index, where only matching the first portion of the route is necessary. But I would think that it would be possible to apply a different logic to the final portion of a URL path, once all module related routing has been handled.

So, again, the goal of this ticket would be to provide a means of having routes applied strictly as entered, without additional URL paths (like /bogus) being automatically parsed as key-value pairs. I'm sure that in some cases, that's helpful, but it's not desirable in every situation, and it would be helpful to be able to disable it.

In terms of workarounds, I'm currently thinking of using something like this:

And then adding handling for invalidpath in my base handler. But I'd need to do this for nearly all the routes that I'm registering.


Luis Majano


Matthew Clemente



Affects versions