You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/21 08:29:26 UTC
[GitHub] [apisix] tinpad opened a new issue #5107: bug: rejected_msg not working in limit-count plugin
tinpad opened a new issue #5107:
URL: https://github.com/apache/apisix/issues/5107
### 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.
I am getting following html content -
<html>
<head><title>429 Too Many Requests</title></head>
<body>
<center><h1>429 Too Many Requests</h1></center>
<hr><center>openresty</center>
</body>
</html>
### Environment
- apisix version (cmd: `apisix version`):
- OS (cmd: `uname -a`):
- OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
- etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
- apisix-dashboard version, if have:
- the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
- luarocks version, if the issue is about installation (cmd: `luarocks --version`):
### Steps to reproduce
as mentioned above, if we exceed the request count more than 10
### Actual result
<html>
<head><title>429 Too Many Requests</title></head>
<body>
<center><h1>429 Too Many Requests</h1></center>
<hr><center>openresty</center>
</body>
</html>
### 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"}
--
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
[GitHub] [apisix] spacewander closed issue #5107: bug: rejected_msg not working in limit-count plugin
Posted by GitBox <gi...@apache.org>.
spacewander closed issue #5107:
URL: https://github.com/apache/apisix/issues/5107
--
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
[GitHub] [apisix] tinpad commented on issue #5107: bug: rejected_msg not working in limit-count plugin
Posted by GitBox <gi...@apache.org>.
tinpad commented on issue #5107:
URL: https://github.com/apache/apisix/issues/5107#issuecomment-923872990
@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"
}
--
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
[GitHub] [apisix] tokers commented on issue #5107: bug: rejected_msg not working in limit-count plugin
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #5107:
URL: https://github.com/apache/apisix/issues/5107#issuecomment-923778606
@tinpad Have you ever tried to check out the route object by using the GET API?
--
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
[GitHub] [apisix] spacewander commented on issue #5107: bug: rejected_msg not working in limit-count plugin
Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #5107:
URL: https://github.com/apache/apisix/issues/5107#issuecomment-923935003
The rejected_msg is added in 2.9: https://github.com/apache/apisix/pull/4808/
So APISIX 2.8 doesn't support it.
--
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