You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "ruanweihong-aaa (via GitHub)" <gi...@apache.org> on 2026/10/15 02:50:56 UTC

[PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

ruanweihong-aaa opened a new pull request, #14036:
URL: https://github.com/apache/apisix/pull/14036

   ## Summary
   
   - Save the `client-control` body limit in the APISIX request context after the runtime setter succeeds.
   - Restore the limit in `grpc_access_phase()` after the redirect to `@grpc_pass`, with the existing setter and 503 error handling.
   - Add gRPC regression cases for a stricter route limit, zero/unlimited, and a route limit above the global default.
   
   Fixes #14009.
   
   ## Verification
   
   Real Python gRPC client/backend tests on APISIX 3.19.0 reproduced the 5 MiB/2 MiB false 413 and 512 KiB/900 KiB false acceptance. With the modified Lua files mounted, both behaved as configured. Also checked 6 MiB rejection, zero/unlimited, no plugin, with and without Content-Length, ordinary HTTP, and `grpcs` with a TLS backend. LuaJIT syntax compilation and `git diff --check` passed.
   
   The new Test::Nginx cases have **not run**: the available environment lacks `Test::Nginx::Socket::Lua::Stream` and the APISIX Nginx test runtime. Full repository tests and a build from the current master commit have not run; the image mount check is not a full source build.
   
   Draft for review. Another contributor requested assignment on the issue; this PR does not claim assignment.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292911366


##########
apisix/init.lua:
##########
@@ -1069,6 +1069,15 @@ function _M.grpc_access_phase()
     if api_ctx.enable_mirror == true and has_mod then
         apisix_ngx_client.enable_mirror()
     end
+
+    if api_ctx.client_max_body_size and has_mod then

Review Comment:
   谢谢指出,你说得对。已在提交 `3eccc1e8` 中删除多余的 `has_mod` 判断。`client-control` 只有在成功调用 `set_client_max_body_size` 后,才会把限制值保存到请求上下文。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292913982


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1

Review Comment:
   谢谢提醒。已将新增用例移到独立的 `t/node/grpc-client-control.t`,并参照现有 `client-control` 测试加入 `apisix-nginx-module` 检查。缺少该模块时会跳过这些用例,原有的 gRPC 代理测试不受影响。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4293620324


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1

Review Comment:
   Thanks for catching this. I moved the new cases to `t/node/grpc-client-control.t` and added the same `apisix-nginx-module` availability check used by the existing `client-control` test suite. The new cases are skipped when the module is unavailable, while the existing gRPC proxy tests remain runnable.



##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   Agreed—the original small requests could not verify that the raised limit took effect. The test fixture already sets a 30 MiB Nginx limit, so I removed the duplicate directive after CI showed it prevented Nginx from starting. In `adec29cd`, both raised-limit cases send a 31 MiB request, with the plugin set to unlimited or 50 MiB. They expect the upstream gRPC server's `ResourceExhausted` response rather than an APISIX 413, which would show that the request reached the upstream. CI for this revision is still running.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292916027


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   同意,原来的小请求无法验证放宽限制是否生效。补充说明:提交 `adec29cd` 已按 CI 反馈修正测试配置。测试框架自带 30 MiB 的 Nginx 请求体限制;现在两个放宽限制用例都发送 31 MiB 请求,分别使用无限制和 50 MiB 的插件配置。用例预期收到上游 gRPC 服务的 `ResourceExhausted`(它的单条消息上限较低),以确认请求越过了 APISIX 的 30 MiB 限制并到达上游。新提交的 CI 结果仍待确认。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4281217910


##########
apisix/init.lua:
##########
@@ -1069,6 +1069,15 @@ function _M.grpc_access_phase()
     if api_ctx.enable_mirror == true and has_mod then
         apisix_ngx_client.enable_mirror()
     end
+
+    if api_ctx.client_max_body_size and has_mod then

Review Comment:
   The judgment of `has_mod` is redundant, and this judgment does not exist in the code of `apisix/plugins/client-control.lua`.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4293618122


##########
apisix/init.lua:
##########
@@ -1069,6 +1069,15 @@ function _M.grpc_access_phase()
     if api_ctx.enable_mirror == true and has_mod then
         apisix_ngx_client.enable_mirror()
     end
+
+    if api_ctx.client_max_body_size and has_mod then

Review Comment:
   Thanks for pointing this out. I removed the redundant `has_mod` check in `3eccc1e8`. `client-control` saves the limit in the request context only after `set_client_max_body_size` succeeds.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292916027


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   同意,原来的小请求无法验证放宽限制是否生效。补充说明:提交 `adec29cd` 已按 CI 反馈修正测试配置。测试框架自带 30 MiB 的 Nginx 请求体限制;现在两个放宽限制用例都发送 31 MiB 请求,分别使用无限制和 50 MiB 的插件配置。用例预期收到上游 gRPC 服务的 `ResourceExhausted`(它的单条消息上限较低),以确认请求越过了 APISIX 的 30 MiB 限制并到达上游。新提交的 CI 结果仍待确认。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "guoqqqi (via GitHub)" <gi...@apache.org>.
guoqqqi merged PR #14036:
URL: https://github.com/apache/apisix/pull/14036


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292911366


##########
apisix/init.lua:
##########
@@ -1069,6 +1069,15 @@ function _M.grpc_access_phase()
     if api_ctx.enable_mirror == true and has_mod then
         apisix_ngx_client.enable_mirror()
     end
+
+    if api_ctx.client_max_body_size and has_mod then

Review Comment:
   谢谢指出,你说得对。已在提交 `3eccc1e8` 中删除多余的 `has_mod` 判断。`client-control` 只有在成功调用 `set_client_max_body_size` 后,才会把限制值保存到请求上下文。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4284348148


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   Raised-limit cases use tiny requests
   
   The zero and 5 MiB cases send a small request, so both pass even if the original Nginx limit remains in force. The test fixture builds Nginx configuration separately from extra_yaml_config; verify the limit reaches it and send a larger body.



##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1

Review Comment:
   gRPC tests lack a runtime gate
   
   Without apisix-nginx-module, client-control returns 501 before the new gRPC tests reach their assertions. The existing client-control suite skips that environment; these cases need the same gate.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292913982


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1

Review Comment:
   谢谢提醒。已将新增用例移到独立的 `t/node/grpc-client-control.t`,并参照现有 `client-control` 测试加入 `apisix-nginx-module` 检查。缺少该模块时会跳过这些用例,原有的 gRPC 代理测试不受影响。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: preserve client-control body limit for gRPC upstreams [apisix]

Posted by "ruanweihong-aaa (via GitHub)" <gi...@apache.org>.
ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4292916027


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto -plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   同意,原来的小请求无法验证放宽限制是否生效。现在测试入口的 Nginx `--- config` 中设置了 `client_max_body_size 1m`,两个放宽限制用例都会发送 2 MiB 请求。修改包含在提交 `3eccc1e8` 中。



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org