Skip to content

Commit 2db2324

Browse files
committed
Merge pull request kubernetes-retired#898 from aledbf/sort-locations
NGINX Ingress controller Sort locations
2 parents dabfa9f + 3e3de84 commit 2db2324

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/nginx/nginx/nginx.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ type Location struct {
8888
}
8989

9090
// LocationByPath sorts location by path
91+
// Location / is the last one
9192
type LocationByPath []*Location
9293

9394
func (c LocationByPath) Len() int { return len(c) }
9495
func (c LocationByPath) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
9596
func (c LocationByPath) Less(i, j int) bool {
96-
return c[i].Path < c[j].Path
97+
return c[i].Path > c[j].Path
9798
}
9899

99100
// NewDefaultServer return an UpstreamServer to be use as default server that returns 503.

0 commit comments

Comments
 (0)