Automatic redirect from a path ending with trailing slash to the same path without trailing slash #4782
-
As far as i can see i can't see that there is any route option that allows for automatic redirect with
I can fix this manually in my route handlers or in a route hook, however i was wondering if this is something that has been discussed before and if there was some reason that this has not been implemented. I remember having read about some redirection attacks... The reason i ask is that we only want to have one route registered in our web application, however we don't always control outside links to our own web application, and we ofte have links that do this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
No, it hasn't been discussed to my recollection. We really only have support for mapping Personally, I think the desired redirect is better handled at the reverse proxy. |
Beta Was this translation helpful? Give feedback.
Agree with @jsumners that most of this logic should belong to an abstraction layer on top of fastify, like a reverse proxy or API gateway, or any other strategy. Though, I can also understand that some applications might have the desire to have it within the app.
I honestly don't think that it should land on the core, as it sounds like an issue that can cause some maintenance overhead (to not mention the number of issues that can come with it). Having it as a
plugin
sounds like a good way to go 👍You can create the plugin and later open a PR for adding it to the community section.