Closed mahovich closed 2 years ago
I don't know if this is a good idea. @mcollina Any thoughts?
find-my-way is only a router, it does not send responses back. This is a higher level concern (framework): find-my-way responsibility should be to provide enough metadata for a framework to implement this behavior.
Can we close it, then?
Find-my-way
has aignoreTrailingSlash
option that allows to access the same page at the addresses "/foo/" and "/foo".For SEO it would be more useful to add an option that would redirect all requests with a slash at the end of the URL to the same URL without a slash, ignoring the query string (key and value).
For some users of the site (who change the URL in the address bar), it is important to support the processing of the final slash. It is also important not to duplicate the same page for search robots. To solve this problem this new option would be very helpful.
For the Koa framework, there is middleware solving this task koa-no-trailing-slash. But using it before using the
find-my-way
router creates another problem: when accessing the non-existing page "/404/", a redirect will occur to the "/404" page and only then an error will occur - an extra redirect occurs here.If this task will be solved by
find-my-way
with a new option, then when accessing "/404/", an error page will immediately appear.Therefore, would like to see this option in the router, and not to solve it with a separate functionality.
How do you look at adding such an option?