I'd like to configure the Nginx Ingress Controller to optimize the handling of file upload requests by buffering them into temporary files instead of utilizing memory. Specifically when modsecurity(WAF) is enabled, I encountered an issue where uploading 2GB text files resulted in the controller pod consuming 2GB of memory. Upon inspection, I noticed that the client request body buffer was being stored in the temporary directory "/tmp/nginx/client-body/". To address this, I aim to minimize memory usage by buffering requests into temporary files and disable the response buffer. Below is the configuration I utilized with Helm chart values:

```
controller:
       config:
          use-proxy-protocol: "true"
          enable-modsecurity: "true"
          enable-owasp-modsecurity-crs: "true"
          client-body-buffer-size: "8k"  # Set the buffer size for reading client request bodies
          client-max-body-size: "100m"     # Limit the maximum size of the client request body
          proxy-response-buffering: "off"
```

Spec:
nginx version: nginx/1.19.10
k8s server version: v1.23.17
helm version: v3.13.2
Ingress controller helm chart version: 3.39.0

I appreciate any guidance or suggestions on how to optimize this configuration further.
I'd like to configure the Nginx Ingress Controller to buffer upload file content into a temporary file instead of storing it in memory
This is a GitHub Issue
repo:ingress-nginx
owner:kubernetes
Title : I'd like to configure the Nginx Ingress Controller to buffer upload file content into a temporary file instead of storing it in memory
Issue date:

--- start body ---
I'd like to configure the Nginx Ingress Controller to optimize the handling of file upload requests by buffering them into temporary files instead of utilizing memory. Specifically when modsecurity(WAF) is enabled, I encountered an issue where uploading 2GB text files resulted in the controller pod consuming 2GB of memory. Upon inspection, I noticed that the client request body buffer was being stored in the temporary directory "/tmp/nginx/client-body/". To address this, I aim to minimize memory usage by buffering requests into temporary files and disable the response buffer. Below is the configuration I utilized with Helm chart values:

```
controller:
       config:
          use-proxy-protocol: "true"
          enable-modsecurity: "true"
          enable-owasp-modsecurity-crs: "true"
          client-body-buffer-size: "8k"  # Set the buffer size for reading client request bodies
          client-max-body-size: "100m"     # Limit the maximum size of the client request body
          proxy-response-buffering: "off"
```

Spec:
nginx version: nginx/1.19.10
k8s server version: v1.23.17
helm version: v3.13.2
Ingress controller helm chart version: 3.39.0

I appreciate any guidance or suggestions on how to optimize this configuration further.
--- end body ---

None