bhuvan-somisetty opened a new pull request, #13936: URL: https://github.com/apache/apisix/pull/13936
### Description The `limit-conn` plugin doc has no example showing how to use it in stream (L4/TCP) proxy mode, even though the plugin has supported stream proxy since it was written (`apisix/stream/plugins/limit-conn.lua`). **Root cause:** the doc gap, plus a prior attempt (#13052) that tried to close this issue documented an incorrect restriction — that only `remote_addr`/`server_addr` can be used as `key`. That's not accurate: in `apisix/plugins/limit-conn/init.lua`, when `key_type` is `var` (the default), the key is resolved via `ctx.var[conf_key]`, i.e. plain NGINX stream-variable lookup. Any variable available in the stream context works (e.g. `server_port`), not just `remote_addr`/`server_addr`. **Solution:** - Added an "Apply Rate Limiting in Stream Proxy" section to `docs/en/latest/plugins/limit-conn.md`, following the doc's existing Admin API / ADC / Ingress Controller tabbed example format, with a full, copy-pasteable `stream_routes` example (including `upstream`). - Documented the `key` resolution behavior accurately instead of the narrower (incorrect) restriction from the earlier attempt. - Added a regression test in `t/stream-plugin/limit-conn.t` (`key: "server_port"` with default `key_type: var`) so the corrected documentation claim is backed by an actual test, guarding against future regressions in the key-resolution logic. ### Which issue(s) this PR fixes: Fixes #4933 ### Testing Ran the modified `t/stream-plugin/limit-conn.t` (all 12 test blocks, including the 2 new ones) locally against a real OpenResty + etcd environment — all pass. Also ran `markdownlint-cli` against the modified doc file with the repo's `.markdownlint.yml` config — no findings. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [x] I have updated the documentation to reflect this change - [x] I have verified that this change is backward compatible -- 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]
