Skip to content
New issue

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

bug: Setting rejected_msg in "limit-req" plugin does not save #2310

Closed
1657486787 opened this issue Jan 28, 2022 · 19 comments
Closed

bug: Setting rejected_msg in "limit-req" plugin does not save #2310

1657486787 opened this issue Jan 28, 2022 · 19 comments
Assignees

Comments

@1657486787
Copy link

1657486787 commented Jan 28, 2022

Issue description

Setting rejected_msg in "limit-req" plugin does not save

Environment

  • apisix version (cmd: apisix version):2.12
  • OS (cmd: uname -a):Linux wx-2 3.10.0-1160.el7.x86_64

Steps to reproduce

1.Set rejected_msg in "limit-req" plugin , eg:
{
"rate": 1,
"burst": 1,
"key_type": "var",
"key": "1",
"rejected_code": 503,
"nodelay": false,
"rejected_msg":"请求太多了,稍后重试..."
}
2. After saving, go in and check again, and find that it is not saved, eg:
{
"rate": 1,
"burst": 1,
"key_type": "var",
"key": "1",
"rejected_code": 503,
"nodelay": false
}

Actual result

{
"rate": 1,
"burst": 1,
"key_type": "var",
"key": "1",
"rejected_code": 503,
"nodelay": false
}

Error log

nothing

Expected result

{
"rate": 1,
"burst": 1,
"key_type": "var",
"key": "1",
"rejected_code": 503,
"nodelay": false,
"rejected_msg":"请求太多了,稍后重试..."
}

@leslie-tsang
Copy link
Member

Hello there, Please provide you environment info in the description.

@1657486787
Copy link
Author

Hello there, Please provide you environment info in the description.
ok ,my environment info :

@tokers
Copy link
Contributor

tokers commented Jan 28, 2022

How did you create the plugin? Using Admin API or Manager API?

@1657486787
Copy link
Author

How did you create the plugin? Using Admin API or Manager API?

using manager api

@tzssangglass
Copy link
Member

Can you post the full configuration of this route in etcd? That way I can verify it directly.

@1657486787
Copy link
Author

Can you post the full configuration of this route in etcd? That way I can verify it directly.

the configuration is:
{
"uri": "/dw2/*",
"name": "route_limit_req",
"methods": [
"GET"
],
"plugins": {
"ext-plugin-pre-req": {
"conf": [
{
"name": "TokenValidator",
"value": "{"validate_header":"token","validate_url":"434","rejected_code":"406"}"
}
],
"disable": true
},
"limit-req": {
"burst": 1,
"disable": false,
"key": "1",
"key_type": "var",
"nodelay": false,
"rate": 1,
"rejected_code": 503,
"rejected_msg": "请求太多了,稍后重试..."
},
"request-id": {
"disable": true,
"header_name": "mk-id",
"include_in_response": true
},
"response-rewrite": {
"body_base64": false,
"disable": true,
"headers": {
"X-Server-balancer_addr": "$balancer_ip:$balancer_port",
"X-Server-id": 3,
"X-Server-status": "on",
"body": "{"code":"ok","message":"new json body"}"
},
"vars": [
[
"status",
"==",
200
]
]
}
},
"upstream_id": "392266237876372160",
"status": 1
}

1.Set rejected_msg in "limit-req" plugin , eg:
image

  1. After saving, go in and check again, and find that it is not saved, eg:
    image

@tzssangglass
Copy link
Member

@guoqqqi @bzp2010 I tried to add the plugin with curl without any problem, is it because dashboard doesn't support it?

@leslie-tsang
Copy link
Member

@guoqqqi @bzp2010 I tried to add the plugin with curl without any problem, is it because dashboard doesn't support it?

I just tried it with the dashboard and couldn't reproduce the problem either.

@tokers
Copy link
Contributor

tokers commented Feb 7, 2022

Can you post the full configuration of this route in etcd? That way I can verify it directly.

the configuration is: { "uri": "/dw2/*", "name": "route_limit_req", "methods": [ "GET" ], "plugins": { "ext-plugin-pre-req": { "conf": [ { "name": "TokenValidator", "value": "{"validate_header":"token","validate_url":"434","rejected_code":"406"}" } ], "disable": true }, "limit-req": { "burst": 1, "disable": false, "key": "1", "key_type": "var", "nodelay": false, "rate": 1, "rejected_code": 503, "rejected_msg": "请求太多了,稍后重试..." }, "request-id": { "disable": true, "header_name": "mk-id", "include_in_response": true }, "response-rewrite": { "body_base64": false, "disable": true, "headers": { "X-Server-balancer_addr": "$balancer_ip:$balancer_port", "X-Server-id": 3, "X-Server-status": "on", "body": "{"code":"ok","message":"new json body"}" }, "vars": [ [ "status", "==", 200 ] ] } }, "upstream_id": "392266237876372160", "status": 1 }

1.Set rejected_msg in "limit-req" plugin , eg: image

  1. After saving, go in and check again, and find that it is not saved, eg:
    image

What's the dashboard version?

@1657486787
Copy link
Author

I tried to add the plugin with curl without any problem, is it because dashboard doesn't support it?

I think so

@1657486787
Copy link
Author

Can you post the full configuration of this route in etcd? That way I can verify it directly.

the configuration is: { "uri": "/dw2/*", "name": "route_limit_req", "methods": [ "GET" ], "plugins": { "ext-plugin-pre-req": { "conf": [ { "name": "TokenValidator", "value": "{"validate_header":"token","validate_url":"434","rejected_code":"406"}" } ], "disable": true }, "limit-req": { "burst": 1, "disable": false, "key": "1", "key_type": "var", "nodelay": false, "rate": 1, "rejected_code": 503, "rejected_msg": "请求太多了,稍后重试..." }, "request-id": { "disable": true, "header_name": "mk-id", "include_in_response": true }, "response-rewrite": { "body_base64": false, "disable": true, "headers": { "X-Server-balancer_addr": "$balancer_ip:$balancer_port", "X-Server-id": 3, "X-Server-status": "on", "body": "{"code":"ok","message":"new json body"}" }, "vars": [ [ "status", "==", 200 ] ] } }, "upstream_id": "392266237876372160", "status": 1 }
1.Set rejected_msg in "limit-req" plugin , eg: image

  1. After saving, go in and check again, and find that it is not saved, eg:
    image

What's the dashboard version?

2.10.1

@1657486787
Copy link
Author

@guoqqqi @bzp2010 I tried to add the plugin with curl without any problem, is it because dashboard doesn't support it?

I just tried it with the dashboard and couldn't reproduce the problem either.

I use dashboard version is 2.10.1, do you try?

@leslie-tsang
Copy link
Member

I use dashboard version is 2.10.1, do you try?

@1657486787 The test environment was launched with apisix-docker, and the apisix-dashboard version is 2.10.1

Can you restart the apisix-dashborad and try again?

@leslie-tsang
Copy link
Member

@1657486787 There seems to be something to do with #2285

@1657486787
Copy link
Author

I use dashboard version is 2.10.1, do you try?

@1657486787 The test environment was launched with apisix-docker, and the apisix-dashboard version is 2.10.1

Can you restart the apisix-dashborad and try again?

I just tested restarting apisix-dashborad , but it didn't work

@tzssangglass tzssangglass transferred this issue from apache/apisix Feb 9, 2022
@zaunist
Copy link
Contributor

zaunist commented Feb 9, 2022

@1657486787 I checked this issue, due to rejected_msg is not supported on the front-end form, it is not displayed, but there is already data in etcd. We should support this filed in front, @guoqqqi please take a look.
image

@oil-oil
Copy link
Contributor

oil-oil commented Feb 11, 2022

Please assign it to me, I'll fix this.

@tzssangglass
Copy link
Member

Please assign it to me, I'll fix this.

@oil-oil assigned you, have fun.

@oil-oil
Copy link
Contributor

oil-oil commented Mar 10, 2022

The PR related to this issue has been merged. I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants