Option for trailing slash


ColdBox is currently opinionated on whether to add a trailing slash on the end of the URL. I have found 2 places where it checks to make sure the URL has a trailing slash:

coldbox.system.web.Controller.relocate() around line 438 in v6.0.0
coldbox.system.web.routing.Router.addRoute() around line 835 in v6.0.0

I know ColdBox uses convention over configuration as a rule of thumb and is therefore a very opinionated framework, but I submit that you allow the option to remove the trailing slash. The trailing slash is a preference that can be defaulted, but ultimately decided by the user of the framework.


Joel Tobey
September 29, 2020, 12:20 AM

Another place you can find a trailing slash being added is in the event.getCurrentRoutedUrl() function. Even though my browser doesn’t have a trailing slash, this function returns with a trailing slash, which can throw off logic that relies on it to redirect the user.

Joel Tobey
September 29, 2020, 1:48 AM

An example of a module that uses the event.getCurrentRoutedUrl() value is the redirectBack module. We could have this and every module/personal code modify the string to remove the trailing slash if needed, but it would be cleaner, in my opinion, if the framework had a setting to have it or not.

Luis Majano
September 30, 2020, 1:35 PM

Hi I can see the controller adding a / at the end of the string when doing relocations. However, the addRoute() method just cleans INITIAL / to avoid initial double slashes, but nothing to do with ending slashes. Is this the only place you can see for ending slashes, because I also don’t see this in the buildLink() method.

Luis Majano
October 21, 2020, 8:18 PM

Any more feedback on this I need it in order to proceed.



Luis Majano


Joel Tobey