Group routes does not work without leading slash
Author: sayeed1999Created Sep 15, 2026Updated Sep 15, 2026
Group route does not work without leading slash
I ran into an unexpected behavior with grouped routes.
g := e.Group("/v1")
g.GET("posts", handler)Requesting:
GET /v1/postsreturns:
Not FoundChanging it to:
g.GET("/posts", handler)works as expected.
I would expect Echo to handle the missing leading / when combining the group prefix and route path, or at least provide a warning during route registration.
It would be nice if both forms resulted in /v1/posts:
g.GET("posts", handler)
g.GET("/posts", handler)Because it is very normal for a developer to not provide the slash since a group already means it's under that group (so slash should come automatically)
Otherwise its too confusing and something to forget easily when using the framework!!
Source: labstack/echo