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 2020/09/25 16:12:40 UTC
[GitHub] [apisix] membphis opened a new issue #2320: bug: limit-req plugin can not work properly for this case.
membphis opened a new issue #2320:
URL: https://github.com/apache/apisix/issues/2320
It seems a bit complicated, we need a smaller test case to find the problem easily.
```
=== TEST 1: create consumer
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/consumers',
ngx.HTTP_PUT,
[[{
"username": "jack",
"plugins": {
"key-auth": {
"key": "auth-one"
}
}
}]]
)
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
=== TEST 2: set service
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/services/1',
ngx.HTTP_PUT,
[[{
"plugins": {
"key-auth": {}
},
"desc": "new service"
}]]
)
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
=== TEST 3: create route with plugin `limit-req`(upstream node contain domain)
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/routes/1',
ngx.HTTP_PUT,
[[{
"plugins": {
"limit-req": {
"rate": 1,
"burst": 0,
"rejected_code": 503,
"key": "remote_addr"
}
},
"upstream": {
"nodes": {
"www.baidu.com:80": 1
},
"pass_host": "node",
"type": "roundrobin"
},
"service_id": 1,
"uri": "/index.html"
}]]
)
if code >= 300 then
ngx.status = code
end
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
=== TEST 4: make a test
--- config
location /t {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin")
local headers = {
["User-Agent"] = "curl/7.68.0",
["apikey"] = "auth-one",
}
for i = 1, 3 do
local code, body = t.test('/index.html',
ngx.HTTP_GET,
"",
nil,
headers
)
ngx.say("return: ", code)
end
}
}
--- request
GET /t
--- response_body
return: 200
return: 503
return: 503
--- no_error_log
[error]
--- timeout: 10
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2320: bug: limit-req plugin can not work properly for this case.
Posted by GitBox <gi...@apache.org>.
spacewander closed issue #2320:
URL: https://github.com/apache/apisix/issues/2320
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org