Skip to content

Commit

Permalink
Disallow client_body_buffer_size annotation from location /
Browse files Browse the repository at this point in the history
Currently when the client_body_buffer_size is set it configures
all locations in the rules as well as location /. This will
disallow client_body_buffer_size from being configured in /.
  • Loading branch information
Fernando Diaz committed Aug 22, 2017
1 parent ed3803c commit c61eb33
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,7 @@ func (ic *GenericController) getBackendServers() ([]*ingress.Backend, []*ingress

anns := ic.annotations.Extract(ing)

// setup client-buffer-body-size based on annotations
clientBufferBodySizeAnnotation := ic.annotations.ClientBodyBufferSize(ing)
var clientBufferBodySizeAnnotation string

for _, rule := range ing.Spec.Rules {
host := rule.Host
Expand Down Expand Up @@ -664,6 +663,10 @@ func (ic *GenericController) getBackendServers() ([]*ingress.Backend, []*ingress
nginxPath := rootLocation
if path.Path != "" {
nginxPath = path.Path
// setup client-buffer-body-size based on annotations
clientBufferBodySizeAnnotation = ic.annotations.ClientBodyBufferSize(ing)
} else {
clientBufferBodySizeAnnotation = ""
}

addLoc := true
Expand All @@ -682,13 +685,13 @@ func (ic *GenericController) getBackendServers() ([]*ingress.Backend, []*ingress
loc.Backend = ups.Name
loc.Port = ups.Port
loc.Service = ups.Service
loc.ClientBodyBufferSize = clientBufferBodySizeAnnotation
mergeLocationAnnotations(loc, anns)
if loc.Redirect.FromToWWW {
server.RedirectFromToWWW = true
}
break
}
loc.ClientBodyBufferSize = clientBufferBodySizeAnnotation
}
// is a new location
if addLoc {
Expand Down Expand Up @@ -1065,9 +1068,6 @@ func (ic *GenericController) createServers(data []interface{},
}
}

// setup client-buffer-body-size based on annotations
clientBufferBodySizeAnnotation := ic.annotations.ClientBodyBufferSize(ing)

for _, rule := range ing.Spec.Rules {
host := rule.Host
if host == "" {
Expand All @@ -1087,7 +1087,6 @@ func (ic *GenericController) createServers(data []interface{},
Backend: un,
Proxy: ngxProxy,
Service: &api.Service{},
ClientBodyBufferSize: clientBufferBodySizeAnnotation,
},
}, SSLPassthrough: sslpt}
}
Expand Down

0 comments on commit c61eb33

Please sign in to comment.