myriad-max opened a new issue, #14171: URL: https://github.com/apache/apisix/issues/14171
### Current Behavior With the default client_max_body_size: 0 (no limit), HTTP/1.1 requests using Transfer-Encoding: chunked to a matched route are rejected with 413 Request Entity Too Large generated by the gateway itself. Requests with Content-Length pass, and chunked requests to paths with no route get the normal 404. The 413 is returned in about 1 ms, with no upstream involved: "POST /post HTTP/1.1" 413 255 0.001 "-" "curl/…" - - - "http://…/post" The body is the standard error page: <title>413 Request Entity Too Large</title> … openresty … Powered by APISIX. Request bodies of a few bytes are rejected, so the size is not the cause. This did not happen on 3.16.0. ### Expected Behavior With client_max_body_size 0 (unlimited), chunked request bodies should be accepted, as in 3.16.0. ### Error Logs Access log (3.17.0): "POST /n8n/webhook/notification-delivery HTTP/1.1" 413 255 0.001 "-" "<client>" - - - "http://<host>/webhook/notification-delivery" The 255-byte response body is the standard error page: <title>413 Request Entity Too Large</title> … <center>openresty</center> … Powered by APISIX. ### Steps to Reproduce Minimal, standalone mode (no etcd), reproduced on the stock images: `mkdir apx && cd apx cat > config.yaml <<'EOF' deployment: role: data_plane role_data_plane: config_provider: yaml apisix: enable_admin: false nginx_config: http: client_max_body_size: 0 EOF cat > apisix.yaml <<'EOF' routes: - id: 1 uri: /post upstream: type: roundrobin nodes: "httpbin:8080": 1 #END EOF docker network create apx docker run -d --name httpbin --network apx mccutchen/go-httpbin -port 8080 docker run -d --name apisix --network apx -p 9080:9080 \ -v $PWD/config.yaml:/usr/local/apisix/conf/config.yaml:ro \ -v $PWD/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \ apache/apisix:3.17.0-ubuntu curl -s -o /dev/null -w '%{http_code}\n' --http1.1 -X POST -d '{"a":1}' http://127.0.0.1:9080/post curl -s -o /dev/null -w '%{http_code}\n' --http1.1 -X POST -H 'Transfer-Encoding: chunked' -d '{"a":1}' http://127.0.0.1:9080/post curl -s -o /dev/null -w '%{http_code}\n' --http1.1 -X POST -H 'Transfer-Encoding: chunked' -d '{"a":1}' http://127.0.0.1:9080/no-such-route ` Results on 3.17.0-ubuntu: 200, 413, 404. Replace the image with apache/apisix:3.16.0-ubuntu and the results are 200, 200, 404. Analysis: the cause is in the bundled OpenResty Each row used the same config and the same curl commands (HTTP/1.1, chunked POST to the matched route): APISIX code OpenResty client_max_body_size Chunked POST 3.17.0 1.29.2.4 0 413 3.16.0 1.27.1.2 0 200 3.17.0, with /usr/local/openresty replaced by the one from the 3.16.0 image 1.27.1.2 0 200 3.16.0, with /usr/local/openresty replaced by the one from the 3.17.0 image 1.29.2.4 0 413 3.17.0 1.29.2.4 10m, 1g or 10g 200 So the regression follows the OpenResty build (apisix-runtime 1.3.6, openresty/1.29.2.4) and not APISIX's Lua code. It only occurs when client_max_body_size is 0. Any explicit size avoids it. We haven't determined whether the cause is in nginx 1.29.x itself or in the runtime's patches. Other things we ruled out on our Kubernetes deployment: route plugins (proxy-rewrite, prometheus), a global http-logger rule (disabled and deleted, still 413), and client_body_buffer_size. It also reproduces without etcd (standalone above), without TLS, and without any plugins. **Workaround** Set an explicit size instead of 0, for example client_max_body_size: 1g in nginx_config.http (Helm: apisix.nginx.http.clientMaxBodySize: "1g"). We verified this on a real cluster (Kubernetes, chart apisix 2.17.0, APISIX 3.17.0): chunked POSTs pass. ### Environment - APISIX version (run `apisix version`): 3.17.0 (apache/apisix:3.17.0-ubuntu); last good: 3.16.0 (apache/apisix:3.16.0-ubuntu) - Operating system (run `uname -a`): Linux ubuntu-24-01 7.0.0-42-generic #42~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 19 14:43:01 UTC 2 x86_64 x86_64 x86_64 GNU/Linux - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 3.17.0: openresty/1.29.2.4, built by gcc 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1), OpenSSL 3.4.1 11 Feb 2025. 3.16.0: openresty/1.27.1.2, same compiler and OpenSSL. - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): etcd 3.7.0 (API 3.7, Go 1.26.5), image quay.io/coreos/etcd:v3.7.0, - APISIX Dashboard version, if relevant: - Plugin runner version, for issues related to plugin runners: - LuaRocks version, for installation issues (run `luarocks --version`): -- 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]
