Skip to content

How to set the maximum client body size for nginx ingress controller

This document (000021309) is provided subject to the disclaimer at the end of this document.

Environment

Rancher 2.6.x , 2.7.x, 2.8.x

Situation

NGINX Ingress in Kubernetes may encounter a 413 error (Request Entity Too Large) when attempting to upload or send large files. This error occurs because NGINX Ingress imposes a default limit on the request body size.

Date [warn] 146749#146749: *2157831389 a client request body is buffered to a temporary file /tmp/nginx/client-body/0046932384,

Resolution

Adjust the proxy-body-size setting using the nginx.ingress.kubernetes.io/proxy-body-size annotation in their Ingress resource. This setting determines the maximum allowed size for the request body.

Applying the Annotation:

At the Ingress Level: Add the following annotation to your Ingress resource:

  nginx.ingress.kubernetes.io/proxy-body-size: "4096m"

Cause

The NGINX Ingress controller imposes a limit on the size of the client request body it can handle. When a client attempts to send a request with a body larger than this limit, NGINX responds with a 413 Request Entity Too Large error.

Status

Top Issue

Additional Information

https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#custom-max-body-size

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-max-body-size

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.