nginx - nginx ingress 中的 body 大小到底是多少?

标签 nginx kubernetes nginx-ingress

我正在尝试为 proxy-body-size 注释设置一个值,但我确定如何得出相同的数字。例如,如果我推送值(value) 2GB 的数据,1GB 的主体大小会抛出“413 请求太大”错误,而 3GB 的限制可以正常工作。

所以我想了解 nginx 中的 body size 到底是什么。它是一个数据包/整个数据的较小部分还是整个数据(比如我上面提到的 2GB)。

如有任何帮助,我们将不胜感激。

最佳答案

您必须在请求正文中设置允许的最大大小。因此,您必须将值设置为大于您尝试推送的数据大小。

来自文档 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

关于nginx - nginx ingress 中的 body 大小到底是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63399481/

相关文章:

nginx - 无法在非根上下文路径中通过 kubernetes ingress-nginx 使 websocket 应用程序工作

Nginx入口 Controller 未提供Prometheus指标

nginx - 如何在Kubernetes Nginx Ingress Controller中将Nginx IP附加到X-Forwarded-For

ubuntu - 如何在 ubuntu 服务器上使用 Mozjpeg 批量优化图像?

java - KubernetesMockServer - 在每次测试之前删除响应

kubernetes - 增加 kubernetes 上永久磁盘的大小

kubernetes - 使用 Kubernetes 入口设置 "Cache-Control" header

azure - 如何使用 nginx-ingress 将外部域 "uat.test.com "添加到我的 kubernetes 集群?

regex - Nginx 使用特殊字符和正则表达式重写规则

node.js - 让 nginx 重定向到随机端口