How to set the maximum allowed size of the client request body for an Ingress with ingress-nginx
This document (000021309) is provided subject to the disclaimer at the end of this document.
Environment
A Kubernetes cluster with the ingress-nginx ingress controller
Situation
The ingress-nginx controller in Kubernetes may return a 413 response code (Request Entity Too Large) when attempting to upload or send large files. This error occurs because ingress-nginx imposes a default limit of 1MB on the request body size.
192.168.1.10 - - [22/Aug/2025:15:10:25 +0000] "POST /upload HTTP/1.1" 413 583 "-" "curl/7.68.0" 10485760 0.000 [-] - - - - a1b2c3d4-e5f6-7890-1234-567890abcdef
Resolution
The allowed maximum size of the client request body can be set at either the individual Ingress level, or of the default value for all Ingresses can be set in the ingress-nginx controller ConfigMap.
Updating the maximum request body size at the Ingress level
Adjust the proxy-body-size
setting using the nginx.ingress.kubernetes.io/proxy-body-size
annotation in the Ingress resource. This setting determines the maximum allowed size of the request body for requests to this individual Ingress. For example, set the following annotation on the Ingress to set a maximum allowed size of 4096MB.
nginx.ingress.kubernetes.io/proxy-body-size: "4096m"
Updating the default request maximum body size in the ingress-nginx configuration
Adjust the proxy-body-size
in the ingress-nginx controller's ConfigMap.
For RKE2 clusters this configuration can be defined by creating a HelmChartConfig resource in the cluster, to customise the values of the deployed rke2-ingress-nginx chart. In the following example, the maximum allowed size of the client request body is set to 5MB.
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: rke2-ingress-nginx
namespace: kube-system
spec:
valuesContent: |-
controller:
config:
proxy-body-size: 5m
For standalone RKE2 clusters, this HelmChartConfig can be added via a manifest in the /var/lib/rancher/rke2/server/manifests directory on a server node. For Rancher-provisioned RKE2 clusters, the HelmChartConfig can be added via the Additional Manifest form of the Edit Config interface within Cluster Management.
Cause
The ingress-nginx controller imposes a limit on the size of the client request body it will accept, with a default of 1MB. When a client attempts to send a request with a body larger than this limit, ingress-nginx responds with a 413 Request Entity Too Large response code.
Status
Top Issue
Additional Information
- ingress-nginx documentation on defining a 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.