Skip to content

Commit

Permalink
Merge pull request #1379 from aledbf/catch-all
Browse files Browse the repository at this point in the history
Fix catch all  upstream server
  • Loading branch information
aledbf committed Sep 17, 2017
2 parents 2c3b29c + b28d990 commit 456793f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,13 +1124,26 @@ func (ic *GenericController) createServers(data []interface{},

// check if ssl passthrough is configured
sslpt := ic.annotations.SSLPassthrough(ing)

// default upstream server
du := ic.getDefaultUpstream()
un := du.Name

if ing.Spec.Backend != nil {
// replace default backend
defUpstream := fmt.Sprintf("%v-%v-%v", ing.GetNamespace(), ing.Spec.Backend.ServiceName, ing.Spec.Backend.ServicePort.String())
if backendUpstream, ok := upstreams[defUpstream]; ok {
un = backendUpstream.Name

// Special case:
// ingress only with a backend and no rules
// this case defines a "catch all" server
defLoc := servers[defServerName].Locations[0]
if defLoc.IsDefBackend && len(ing.Spec.Rules) == 0 {
defLoc.IsDefBackend = false
defLoc.Backend = backendUpstream.Name
defLoc.Service = backendUpstream.Service
}
}
}

Expand Down

0 comments on commit 456793f

Please sign in to comment.