We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using below request to setup limit-count as global rule.
curl http://127.0.0.1:9080/apisix/admin/global_rules/111 -H 'X-API-KEY: xxxxxxxxxxxxxxxxxxxx' -X PUT -d ' { "plugins": { "limit-count": { "time_window": 60, "policy": "local", "count": 10, "key": "remote_addr", "rejected_code": 429, "rejected_msg" : "{"message":"Request Limit Exceeded"}" } } }' When I hit the below route and the count exceeds the count 10 -
http://127.0.0.1:9080/order/list?pageSize=10
I am getting 429 but not getting the response in json format as mentioned in the above route. I am getting following html content -
apisix version
uname -a
nginx -V
openresty -V
curl http://127.0.0.1:9090/v1/server_info
luarocks --version
as mentioned above, if we exceed the request count more than 10
2021/09/21 13:57:03 [warn] 2926#2926: *85612 [lua] plugin.lua:658: run_plugin(): limit-count exits with http status code 429, client: 127.0.0.1, server: _, request: "GET /order/list?pageSize=10 HTTP/1.1", host: "127.0.0.1:9080"
{"message":"Request Limit Exceeded"}
The text was updated successfully, but these errors were encountered:
@tinpad Have you ever tried to check out the route object by using the GET API?
Sorry, something went wrong.
@tokers I am getting below json with get api
{ "node": { "dir": true, "nodes": [ { "createdIndex": 1989, "key": "/apisix/global_rules/111", "modifiedIndex": 3019, "value": { "plugins": { "limit-count": { "key": "remote_addr", "rejected_code": 429, "redis_database": 0, "policy": "local", "time_window": 60, "rejected_msg": "{"message":"Request Limit Exceeded"}", "count": 10 }, "uri-blocker": { "block_rules": [ "script.bat", "script.sh", "script.exe" ], "rejected_code": 403 }, "http-logger": { "retry_delay": 1, "timeout": 3, "uri": "http://192.168.1.2:8060/logger/log", "auth_header": "", "buffer_duration": 60, "batch_max_size": 1000, "include_req_body": false, "inactive_timeout": 5, "max_retry_count": 0, "name": "http logger", "concat_method": "json" }, "basic-auth": {}, "prometheus": { "prefer_name": false } }, "id": "111", "update_time": 1632221711, "create_time": 1631798886 } } ], "key": "/apisix/global_rules" }, "count": "3", "action": "get" }
The rejected_msg is added in 2.9: #4808 So APISIX 2.8 doesn't support it.
No branches or pull requests
Issue description
I am using below request to setup limit-count as global rule.
curl http://127.0.0.1:9080/apisix/admin/global_rules/111 -H 'X-API-KEY: xxxxxxxxxxxxxxxxxxxx' -X PUT -d '
{
"plugins": {
"limit-count": {
"time_window": 60,
"policy": "local",
"count": 10,
"key": "remote_addr",
"rejected_code": 429,
"rejected_msg" : "{"message":"Request Limit Exceeded"}"
}
}
}'
When I hit the below route and the count exceeds the count 10 -
http://127.0.0.1:9080/order/list?pageSize=10
I am getting 429 but not getting the response in json format as mentioned in the above route.
<title>429 Too Many Requests</title>I am getting following html content -
429 Too Many Requests
openresty
Environment
apisix version
): 2.8uname -a
): 20.04.1-Ubuntunginx -V
oropenresty -V
): openresty/1.19.3.2curl http://127.0.0.1:9090/v1/server_info
to get the info from server-info API): 3.4.0luarocks --version
): 3.4.0Steps to reproduce
as mentioned above, if we exceed the request count more than 10
Actual result
<title>429 Too Many Requests</title>429 Too Many Requests
openresty
Error log
2021/09/21 13:57:03 [warn] 2926#2926: *85612 [lua] plugin.lua:658: run_plugin(): limit-count exits with http status code 429, client: 127.0.0.1, server: _, request: "GET /order/list?pageSize=10 HTTP/1.1", host: "127.0.0.1:9080"
Expected result
{"message":"Request Limit Exceeded"}
The text was updated successfully, but these errors were encountered: