diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f93f3e7..76b42426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master / unreleased +* [ENHANCEMENT] Expose `nginx.config.client_body_buffer_size` to set the nginx `client_body_buffer_size` #350 + ## 3.5.0 / 2026-10-08 * [FEATURE] Add trafficDistribution attribute to services #674 diff --git a/README.md b/README.md index bf6e7104..0cabbd76 100644 --- a/README.md +++ b/README.md @@ -480,6 +480,7 @@ Kubernetes: `^1.19.0-0` | nginx.​autoscaling.​targetMemoryUtilizationPercentage | int | `0` | | | nginx.​config.​auth_orgs | list | `[]` | Optional list of [auth tenants](https://cortexmetrics.io/docs/guides/auth/) to set in the nginx config | | nginx.​config.​basicAuthSecretName | string | `""` | Optional name of basic auth secret. In order to use this option, a secret with htpasswd formatted contents at the key ".htpasswd" must exist. For example: apiVersion: v1 kind: Secret metadata: name: my-secret namespace: stringData: .htpasswd: | user1:$apr1$/woC1jnP$KAh0SsVn5qeSMjTtn0E9Q0 user2:$apr1$QdR8fNLT$vbCEEzDj7LyqCMyNpSoBh/ Please note that the use of basic auth will not identify organizations the way X-Scope-OrgID does. Thus, the use of basic auth alone will not prevent one tenant from viewing the metrics of another. To ensure tenants are scoped appropriately, explicitly set the `X-Scope-OrgID` header in the nginx config. Example setHeaders: X-Scope-OrgID: $remote_user | +| nginx.​config.​client_body_buffer_size | string | `""` | ref: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size Requests with a body larger than this are buffered to a temporary file. If empty, the nginx default is used. | | nginx.​config.​client_max_body_size | string | `"1M"` | ref: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size | | nginx.​config.​dnsResolver | string | `"kube-dns.kube-system.svc.cluster.local"` | | | nginx.​config.​dnsTTL | string | `"15s"` | Including the valid parameter to the `resolver` directive to re-resolve names every `dnsTTL` seconds/minutes | diff --git a/templates/nginx/nginx-config.yaml b/templates/nginx/nginx-config.yaml index 3705e2d4..ae396a95 100644 --- a/templates/nginx/nginx-config.yaml +++ b/templates/nginx/nginx-config.yaml @@ -25,6 +25,9 @@ data: http { default_type application/octet-stream; client_max_body_size {{.Values.nginx.config.client_max_body_size}}; + {{- with .Values.nginx.config.client_body_buffer_size }} + client_body_buffer_size {{ . }}; + {{- end }} log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $http_x_scope_orgid'; diff --git a/values.yaml b/values.yaml index 7a307571..3ef58d34 100644 --- a/values.yaml +++ b/values.yaml @@ -1342,6 +1342,9 @@ nginx: dnsResolver: kube-dns.kube-system.svc.cluster.local # -- ref: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size client_max_body_size: 1M + # -- ref: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size + # Requests with a body larger than this are buffered to a temporary file. If empty, the nginx default is used. + client_body_buffer_size: "" # -- arbitrary snippet to inject in the http { } section of the nginx config httpSnippet: "" # -- arbitrary snippet to inject in the top section of the nginx config