diff --git a/.aspell.yml b/.aspell.yml index 260a5fb4..7ee48f4d 100644 --- a/.aspell.yml +++ b/.aspell.yml @@ -1,6 +1,7 @@ mode: commit min_length: 3 allowed: + - acl - aspell - repo - yaml diff --git a/pkg/route/route.go b/pkg/route/route.go index f8d94c4f..b9b94884 100644 --- a/pkg/route/route.go +++ b/pkg/route/route.go @@ -108,16 +108,13 @@ func AddCustomRoute(route Route, routeACLAnn string, api api.HAProxyClient) (err } if route.Path.Path != "" { if route.Path.PathTypeMatch == store.PATH_TYPE_EXACT { - if routeCond == "" { - routeCond = fmt.Sprintf("{ path %s }", route.Path.Path) - } else { - routeCond = fmt.Sprintf("%s { path %s }", routeCond, route.Path.Path) - } + routeCond = fmt.Sprintf("%s{ path %s }", routeCond, route.Path.Path) } else { - if routeCond == "" { - routeCond = fmt.Sprintf("{ path -m beg %s }", route.Path.Path) + if route.Path.Path == "/" { + routeCond = fmt.Sprintf("%s{ path -m beg %s }", routeCond, route.Path.Path) } else { - routeCond = fmt.Sprintf("%s { path -m beg %s }", routeCond, route.Path.Path) + path := strings.TrimSuffix(route.Path.Path, "/") + routeCond = fmt.Sprintf("%s{ path -m reg ^%s($|/) }", routeCond, path) } } }