gpt4 book ai didi

java - nginx - 我可以在哪里放置 client_max_body_size 属性?

转载 作者:行者123 更新时间:2023-11-30 02:45:24 24 4
gpt4 key购买 nike

我需要在某些网址上甚至在我的应用程序上使用 - client_max_body_size 属性(通过 nginx.conf)来限制最大主体大小。

我发现这个属性记录在 nginx 站点上:

Syntax:   client_max_body_size size;
Default:
client_max_body_size 1m;
Context: http, server, location
Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in

a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.

我需要将此属性设置为应用程序的某个部分(不是全局),因此我想将其设置为指定的 url,例如 http://localhost:8088/x/#/y(# 为必填项)

这个特定 URL 的语法是什么?可能吗?

最佳答案

您可以设置client_max_body_size创建位置 block :

location = /x {
client_max_body_size 10M;
}

不幸的是,由于片段永远不会通过 http 发送,因此无法创建 Hook 片段的 location block 。

我不知道/x/#/y背后的逻辑,但您可以开始在/x中设置client_max_body_size

关于java - nginx - 我可以在哪里放置 client_max_body_size 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40327478/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com