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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to