Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

NGINX Ingress controller Sort locations #898

Merged
merged 1 commit into from
May 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ingress/controllers/nginx/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ type Location struct {
}

// LocationByPath sorts location by path
// Location / is the last one
type LocationByPath []*Location

func (c LocationByPath) Len() int { return len(c) }
func (c LocationByPath) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c LocationByPath) Less(i, j int) bool {
return c[i].Path < c[j].Path
return c[i].Path > c[j].Path
}

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