lxbme commented on issue #13673:
URL: https://github.com/apache/apisix/issues/13673#issuecomment-4921840034

   Hi @mcupei, thanks for the issue. I've reproduced this bug and it is caused 
by a rebase mistake at api7/apisix-nginx-module repository.
   
   ## Root cause
   
   APISIX 3.17 bumped the runtime base from OpenResty 1.27.1.2 to 1.29.2.4. 
While porting the patches to the new base, the `&& max_body_size` zero-guard 
was lost in `patch/1.29.2.4/nginx-client_max_body_size.patch` (hunk for 
`ngx_http_request_body_chunked_filter()`):
   
   ```c
   /* old patch — correct */                /* new patch — guard lost */
   if (max_body_size                        if (max_body_size
       && max_body_size                            - 
r->headers_in.content_length_n < rb->chunked->size)
          - r->headers_in.content_length_n < rb->chunked->size)
   ```
   
   Since APISIX defaults to `client_max_body_size 0` (unlimited), the check 
becomes `0 - 0 < chunk_size` → always true → **413 for every HTTP/1.1 chunked 
request**, regardless of size. Requests with `Content-Length` take a different 
code path whose guard is intact, which is why only chunked requests fail.
   
   The fix is already proposed in api7/apisix-nginx-module#115. After it's 
merged, a new apisix-runtime release and rebuilt 3.17.x images are still needed.
   
   ## Workaround
   
   Until a fixed image is released, set any non-zero limit in `config.yaml` 
(verified on 3.17.0):
   
   ```yaml
   nginx_config:
     http:
       client_max_body_size: 1000m
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to