You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "kayx23 (via GitHub)" <gi...@apache.org> on 2026/01/14 11:09:33 UTC
[I] bug: consumer group rate limiting not working when configuring consumer credentials using /credentials endpoint [apisix]
kayx23 opened a new issue, #12912:
URL: https://github.com/apache/apisix/issues/12912
### Current Behavior
Consumer group rate limiting rules are not being applied when consumer credentials are configured using the `/consumers/{username}/credentials` endpoint. However, rate limiting roles work correctly when authentication plugins are configured directly on the consumer.
### Expected Behavior
Consumer group rate limiting rules should work correctly when consumer credentials are configured using the `/consumers/{username}/credentials` endpoint.
### Error Logs
_No response_
### Steps to Reproduce
## Use` /credentials` endpoint (rate limiting not working)
Create consumer groups:
```shell
curl "http://127.0.0.1:9180/apisix/admin/consumer_groups" -X PUT -d '{
"id": "basic_plan",
"plugins": {
"limit-count": {
"count": 2,
"time_window": 30,
"rejected_code": 429
}
}
}'
curl "http://127.0.0.1:9180/apisix/admin/consumer_groups" -X PUT -d '{
"id": "premium_plan",
"plugins": {
"limit-count": {
"count": 20,
"time_window": 30,
"rejected_code": 429
}
}
}'
```
Create consumers:
```shell
curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT -d '{
"username": "JohnDoe",
"group_id": "basic_plan"
}'
curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT -d '{
"username": "FetchBot",
"group_id": "premium_plan"
}'
```
Configure credentials:
```shell
curl "http://127.0.0.1:9180/apisix/admin/consumers/JohnDoe/credentials" -X PUT -d '{
"id": "cred-john-key-auth",
"plugins": {
"key-auth": {
"key": "john-key"
}
}
}'
curl "http://127.0.0.1:9180/apisix/admin/consumers/FetchBot/credentials" -X PUT -d '{
"id": "cred-bot-key-auth",
"plugins": {
"key-auth": {
"key": "bot-key"
}
}
}'
```
Create a route:
```shell
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT -d '{
"id": "rate-limiting",
"uri": "/internal",
"plugins": {
"key-auth": {}
},
"upstream": {
"nodes": {
"mock.api7.ai:443": 1
},
"pass_host": "node",
"scheme": "https"
}
}'
```
Test rate limiting:
```shell
resp=$(seq 10 | xargs -I{} curl "http://127.0.0.1:9080/internal" -H 'apikey: john-key' -o /dev/null -s -w "%{http_code}\n") && \
count_200=$(echo "$resp" | grep "200" | wc -l) && \
count_429=$(echo "$resp" | grep "429" | wc -l) && \
echo "200": $count_200, "429": $count_429
# Result: 200: 10, 429: 0
# SHOULD BE: 200: 2, 429: 8
```
## Configure auth credentials directly on the consumers (rate limiting works)
Create the same consumer groups as above.
Create consumers with auth plugins configured directly:
```shell
curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT -d '{
"username": "JohnDoe",
"group_id": "basic_plan",
"plugins": {
"key-auth": {
"key": "john-key"
}
}
}'
curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT -d '{
"username": "FetchBot",
"group_id": "premium_plan",
"plugins": {
"key-auth": {
"key": "bot-key"
}
}
}'
```
Test rate limiting:
```shell
resp=$(seq 10 | xargs -I{} curl "http://127.0.0.1:9080/internal" -H 'apikey: john-key' -o /dev/null -s -w "%{http_code}\n") && \
count_200=$(echo "$resp" | grep "200" | wc -l) && \
count_429=$(echo "$resp" | grep "429" | wc -l) && \
echo "200": $count_200, "429": $count_429
# Result: 200: 2, 429: 8 (CORRECT)
```
### Environment
APISIX version: 3.14.1
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: consumer group rate limiting not working when configuring consumer credentials using /credentials endpoint [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #12912: bug: consumer group rate limiting not working when configuring consumer credentials using /credentials endpoint
URL: https://github.com/apache/apisix/issues/12912
--
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: [I] bug: consumer group rate limiting not working when configuring consumer credentials using /credentials endpoint [apisix]
Posted by "janiussyafiq (via GitHub)" <gi...@apache.org>.
janiussyafiq commented on issue #12912:
URL: https://github.com/apache/apisix/issues/12912#issuecomment-3869369785
I'd like to work on this issue
--
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