You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Group middleware does not work for "Any" route #2517
g := e.Group("/api/test")
g.Use(echo.WrapMiddleware(mw.NewMW()))
{
g.Any("*", testController.Proxy)
}
actual result is
{
"message": "Not Found"
}
but route cant return anything
Thanks for reporting this. It's been inactive for a long time and may already be resolved in a current release (v5 / v4.15.x). I'm closing to keep the tracker focused — if you still hit this on a current version, please comment with a minimal reproduction and we'll reopen right away. 🙏
Activity
[-]group middleware does not work for any route[/-][+]Group middleware does not work for "Any" route[/+]aldas commentedon Sep 6, 2023
This is little bit tricky.
Let assume group and handler is added like this:
When you add route with
g.Any("*"you will end up with route path/api/test*. This will match both of following requestas your router has following routes

now when we add middleware to that group by uncommenting
g.Use(middleware.Logger())we have following routes

that
4is 404 route for path/api/test/*which is causing problem here as it is more precise match thanapi/test*.As a workaround I suggest:
g.Any("/*"as it will then overwrite that 404 route.g := e.Group("/api/test/")That 404 route is a "feature" that is added here (line 32)
echo/group.go
Lines 21 to 32 in 77d5ae6
vishr commentedon Jun 13, 2026
Thanks for reporting this. It's been inactive for a long time and may already be resolved in a current release (
v5/v4.15.x). I'm closing to keep the tracker focused — if you still hit this on a current version, please comment with a minimal reproduction and we'll reopen right away. 🙏