What exactly is a body size in nginx ingress?

8/13/2020

I am trying to set a value to proxy-body-size annotation but am sure how to come up to a number for the same. For example, if I am pushing data worth 2GB, a body-size of 1GB is throwing a "413 Request too large" error whereas, a 3GB limit works fine.

So I wanted to understand what exactly is a body size in nginx. Is it a packet/smaller part of a whole or a whole data (say 2GB that I'm pushing as mentioned above).

Any help would be greatly appreciated.

-- Rocket9399
kubernetes
nginx
nginx-ingress

1 Answer

8/13/2020

You have to set the maximum allowed size in the request body. So you have to set the value greater than the size of data that you are trying to push.

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

Custom Body Size: For NGINX, an 413 error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter client_max_body_size.

To configure this setting globally for all Ingress rules, the proxy-body-size value may be set in the NGINX ConfigMap. To use custom values in an Ingress rule define these annotation:
nginx.ingress.kubernetes.io/proxy-body-size: 8m
-- Rohit
Source: StackOverflow