Opened 4 months ago
Last modified 4 months ago
#2668 new defect
client_body_buffer_size - Body Larger Than Buffer Size Is Omitted — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | other | Version: | 1.21.x |
Keywords: | client_body_buffer_size | Cc: | |
uname -a: | Linux podname 5.15.133+ #1 SMP Sat Dec 30 13:01:38 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: | openresty/1.21.4.3 |
Description
I set client_body_buffer_size to 4MB and client_max_body_size to 150MB.
When I send a request with a 6 MB body, in access_by_lua_block, the body appears as empty.
access_by_lua_block {
ngx.req.read_body()
local body_data = ngx.req.get_body_data()
if body_data then
ngx.log(ngx.ERR, "Request body: ", body_data)
else
ngx.log(ngx.ERR, "No request body found")
end
}
I see the log "No request body found", even though the body was clearly not empty.
client_body_in_single_buffer is default (wasn't set).
When I increased client_body_buffer_size to 10MB, I had no issues with the 6MB body.
Why is that so? Why does the buffer size cause the body to appear as empty?