Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions docs/user-guide/nginx-configuration/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ To use custom values in an Ingress rule define these annotation:
nginx.ingress.kubernetes.io/proxy-buffering: "on"
```

### Proxy buffers Number
### Proxy buffers number

Sets the number of the buffers in [`proxy_buffers`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers) used for reading the first part of the response received from the proxied server.
By default proxy buffers number is set as 4
Expand All @@ -752,11 +752,9 @@ nginx.ingress.kubernetes.io/proxy-buffer-size: "8k"
### Proxy busy buffers size

[Limits the total size of buffers that can be busy](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size) sending a response to the client while the response is not yet fully read.

By default proxy busy buffers size is set as "8k".
By default, size is limited by the size of two buffers set by the `proxy_buffer_size` and `proxy_buffers` directives.

To configure this setting globally, set `proxy-busy-buffers-size` in the [ConfigMap](./configmap.md#proxy-busy-buffers-size). To use custom values in an Ingress rule, define this annotation:

```yaml
nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "16k"
```
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/nginx-configuration/configmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ The following table shows a configuration option's name, type, and the default v
| [proxy-send-timeout](#proxy-send-timeout) | int | 60 | |
| [proxy-buffers-number](#proxy-buffers-number) | int | 4 | |
| [proxy-buffer-size](#proxy-buffer-size) | string | "4k" | |
| [proxy-busy-buffers-size](#proxy-busy-buffers-size) | string | "8k" | |
| [proxy-busy-buffers-size](#proxy-busy-buffers-size) | string | "" | |
| [proxy-cookie-path](#proxy-cookie-path) | string | "off" | |
| [proxy-cookie-domain](#proxy-cookie-domain) | string | "off" | |
| [proxy-next-upstream](#proxy-next-upstream) | string | "error timeout" | |
Expand Down
6 changes: 2 additions & 4 deletions internal/ingress/annotations/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var proxyAnnotations = parser.Annotation{
Validator: parser.ValidateRegex(parser.SizeRegex, true),
Scope: parser.AnnotationScopeLocation,
Risk: parser.AnnotationRiskLow,
Documentation: `This annotation limits the total size of buffers that can be busy sending a response to the client while the response is not yet fully read. By default proxy busy buffers size is set as "8k".`,
Documentation: `This annotation limits the total size of buffers that can be busy sending a response to the client while the response is not yet fully read.`,
},
proxyCookiePathAnnotation: {
Validator: parser.ValidateRegex(parser.URLIsValidRegex, true),
Expand Down Expand Up @@ -301,11 +301,9 @@ func (a proxy) Parse(ing *networking.Ingress) (interface{}, error) {
config.BufferSize = defBackend.ProxyBufferSize
}

// Only set BusyBuffersSize if annotation is present, blank is NGINX default
// https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
config.BusyBuffersSize, err = parser.GetStringAnnotation(proxyBusyBuffersSizeAnnotation, ing, a.annotationConfig.Annotations)
if err != nil {
config.BusyBuffersSize = ""
config.BusyBuffersSize = defBackend.ProxyBusyBuffersSize
}

config.CookiePath, err = parser.GetStringAnnotation(proxyCookiePathAnnotation, ing, a.annotationConfig.Annotations)
Expand Down
3 changes: 1 addition & 2 deletions internal/ingress/annotations/proxy/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend {
ProxyReadTimeout: 20,
ProxyBuffersNumber: 4,
ProxyBufferSize: "10k",
ProxyBusyBuffersSize: "15k",
ProxyBusyBuffersSize: "",
ProxyBodySize: "3k",
ProxyNextUpstream: "error",
ProxyNextUpstreamTimeout: 0,
Expand Down Expand Up @@ -299,7 +299,6 @@ func TestProxyWithNoAnnotation(t *testing.T) {
}
}

// Add a test for when annotation is set
func TestProxyWithBusyBuffersSizeAnnotation(t *testing.T) {
ing := buildIngress()
data := map[string]string{}
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ func NewDefault() Configuration {
ProxySendTimeout: 60,
ProxyBuffersNumber: 4,
ProxyBufferSize: "4k",
ProxyBusyBuffersSize: "8k",
ProxyBusyBuffersSize: "",
ProxyCookieDomain: "off",
ProxyCookiePath: "off",
ProxyNextUpstream: "error timeout",
Expand Down