Closed ellmetha closed 3 months ago
@ellmetha May i please work on this issue?
@itsayopapi yes feel free to work on it!
It should support multiple use cases
Is there an actual use case for having separate routes which are the same and only differ in the trailing slash? If not, then I would recommend always redirecting to the configured value, not only in case it's not found. It helps the developer to consistently declare routes, e.g. it would prevent adding a route that does not follow project conventions.
Description
Let's introduce a new
routing.append_slash
setting in order to make it possible to configure that an HTTP redirect should be issued for any incoming URL that does not resolve to any routes in case it does not end with a slash. The HTTP redirect should target the same URL but with a slash appended. The reasoning behind that is it helps in normalizing routes and URLs, by enforcing the use of canonical URLs.The default value for this new setting should be
false
. The redirect implementation should probably live in the internalMarten::Server::Handlers::Routing
server handler.