[#2072] registered RemoveTrailingSlash middleware only for the /api/* routes

This commit is contained in:
Gani Georgiev
2023-03-15 18:09:16 +02:00
parent e735d9d21b
commit 254e691e92
2 changed files with 75 additions and 2 deletions
+2 -2
View File
@@ -36,8 +36,8 @@ func InitApi(app core.App) (*echo.Echo, error) {
// default middlewares
e.Pre(middleware.RemoveTrailingSlashWithConfig(middleware.RemoveTrailingSlashConfig{
Skipper: func(c echo.Context) bool {
// ignore Admin UI route(s)
return strings.HasPrefix(c.Request().URL.Path, trailedAdminPath)
// enable by default only for the API routes
return !strings.HasPrefix(c.Request().URL.Path, "/api/")
},
}))
e.Use(middleware.Recover())