diff --git a/lib/gat/server.go b/lib/gat/server.go index 0dd5f243ea06c7cc7211c09afa8b6c1e388cb6d6..1d46328e45481c8beaa20ea50e95035abc13be82 100644 --- a/lib/gat/server.go +++ b/lib/gat/server.go @@ -121,11 +121,15 @@ func (T *Server) Serve(conn *fed.Conn) { T.log.Warn("database not found", zap.String("user", conn.User), zap.String("database", conn.Database)) return nil })) - for j := 0; j < len(T.routes); j++ { + //for j := 0; j < len(T.routes); j++ { + for j := len(T.routes) - 1; j >= 0; j-- { route := T.routes[j] if route.match != nil && !route.match.Matches(conn) { continue } + if route.handle == nil { + continue + } composed = route.handle.Handle(composed) } err := composed.Route(conn)