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/06/27 16:23:22 UTC

[GitHub] [apisix] Applenice opened a new pull request #4493: feat(ip-restriction):Support user-defined configuration message

Applenice opened a new pull request #4493:
URL: https://github.com/apache/apisix/pull/4493


   ### What this PR does / why we need it:
   fix: https://github.com/apache/apisix/issues/4428
   
   Added custom message to ip-restriction plugin and no problem in my local tests. It looks like I need to learn how to write test cases, right?
   
   ### Pre-submission checklist:
   
   * [X] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [X] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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] Applenice commented on pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-870170081


   
   
   
   > @Applenice
   > Need to add test in https://github.com/apache/apisix/blob/master/t/plugin/ip-restriction.t
   
   Okay😊


-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r660227065



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,40 +27,29 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    oneOf = {
-        {
-            title = "whitelist",
-            properties = {
-                whitelist = {
-                    type = "array",
-                    items = {anyOf = core.schema.ip_def},
-                    minItems = 1
-                },
-                message = {
-                    type = "string",
-                    default = "Your IP address is not allowed"
-                },
-            },
-            required = {"whitelist"},
-            additionalProperties = false,
+    properties = {
+        message = {
+            type = "string",
+            minLength = 1,
+            maxLength = 64,

Review comment:
       Would 4096 be too long?What about 1024?😃

##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -41,9 +41,10 @@ in CIDR notation like 10.10.10.0/24 can be used.
 | --------- | ------------- | ----------- | ------- | ----- | ---------------------------------------- |
 | whitelist | array[string] | optional    |         |       | List of IPs or CIDR ranges to whitelist. |
 | blacklist | array[string] | optional    |         |       | List of IPs or CIDR ranges to blacklist. |
+| message | string | optional    | Your IP address is not allowed. | [1, 64] | Message returned in case IP access is not allowed. |
 
-One of `whitelist` or `blacklist` must be specified, and they can not work
-together.
+One of `whitelist` or `blacklist` must be specified, and they can not work together.
+The message supports user-defined configuration.

Review comment:
       ok,later modify




-- 
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] Applenice commented on pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-871563800


   I changed the maxLength value from 64 to 1024, updated the documentation and added test cases, but there is a problem.
   For test cases that are out of maxLength range, it is possible to pass the test using a fixed 1025 length string, but it should not be a graceful operation, how to call it with code generation? I searched some sources and didn't find an answer, so I didn't add a test case for when maxLength is 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] Applenice commented on pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-871851474


   > You can use `string.rep`, like this one:
   > 
   > https://github.com/apache/apisix/blob/d4c7fbbe831bc12c50ba63f00757f0eee14eae15/t/node/upstream-mtls.t#L100
   
   Thanks, I'll try it later


-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659425282



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.

Review comment:
       Thanks for the review, I saw https://github.com/apache/apisix/issues/4428, which mentioned ip-restriction plugin support DIY message, was marked `good first issue`, so wanted to try to implement it.  I'll make the changes mentioned above later.




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r660227222



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -41,9 +41,10 @@ in CIDR notation like 10.10.10.0/24 can be used.
 | --------- | ------------- | ----------- | ------- | ----- | ---------------------------------------- |
 | whitelist | array[string] | optional    |         |       | List of IPs or CIDR ranges to whitelist. |
 | blacklist | array[string] | optional    |         |       | List of IPs or CIDR ranges to blacklist. |
+| message | string | optional    | Your IP address is not allowed. | [1, 64] | Message returned in case IP access is not allowed. |
 
-One of `whitelist` or `blacklist` must be specified, and they can not work
-together.
+One of `whitelist` or `blacklist` must be specified, and they can not work together.
+The message supports user-defined configuration.

Review comment:
       ok,later modify




-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659406575



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -36,6 +36,10 @@ local schema = {
                     items = {anyOf = core.schema.ip_def},
                     minItems = 1
                 },
+                message = {

Review comment:
       And add some limitations for the max length?




-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r660209499



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,40 +27,29 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    oneOf = {
-        {
-            title = "whitelist",
-            properties = {
-                whitelist = {
-                    type = "array",
-                    items = {anyOf = core.schema.ip_def},
-                    minItems = 1
-                },
-                message = {
-                    type = "string",
-                    default = "Your IP address is not allowed"
-                },
-            },
-            required = {"whitelist"},
-            additionalProperties = false,
+    properties = {
+        message = {
+            type = "string",
+            minLength = 1,
+            maxLength = 64,

Review comment:
       64 looks too short to me. What about 4096?

##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -41,9 +41,10 @@ in CIDR notation like 10.10.10.0/24 can be used.
 | --------- | ------------- | ----------- | ------- | ----- | ---------------------------------------- |
 | whitelist | array[string] | optional    |         |       | List of IPs or CIDR ranges to whitelist. |
 | blacklist | array[string] | optional    |         |       | List of IPs or CIDR ranges to blacklist. |
+| message | string | optional    | Your IP address is not allowed. | [1, 64] | Message returned in case IP access is not allowed. |
 
-One of `whitelist` or `blacklist` must be specified, and they can not work
-together.
+One of `whitelist` or `blacklist` must be specified, and they can not work together.
+The message supports user-defined configuration.

Review comment:
       The message can be user-defined.




-- 
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 pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-870160159


   @Applenice 
   Need to add test in https://github.com/apache/apisix/blob/master/t/plugin/ip-restriction.t


-- 
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] Applenice commented on pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-870170081


   
   
   
   > @Applenice
   > Need to add test in https://github.com/apache/apisix/blob/master/t/plugin/ip-restriction.t
   
   Okay😊


-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659464400



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.
+
+```shell
+"plugins": {
+    "ip-restriction": {
+        "whitelist": [
+            "127.0.0.1",
+            "113.74.26.106/24"
+        ],
+        "message": "Do you want to do something bad?"

Review comment:
       https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/ip-restriction.md#attributes
   Need to update the table.




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r660227065



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,40 +27,29 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    oneOf = {
-        {
-            title = "whitelist",
-            properties = {
-                whitelist = {
-                    type = "array",
-                    items = {anyOf = core.schema.ip_def},
-                    minItems = 1
-                },
-                message = {
-                    type = "string",
-                    default = "Your IP address is not allowed"
-                },
-            },
-            required = {"whitelist"},
-            additionalProperties = false,
+    properties = {
+        message = {
+            type = "string",
+            minLength = 1,
+            maxLength = 64,

Review comment:
       Would 4096 be too long?What about 1024?😃




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659476979



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.

Review comment:
       I understand, I will write more clearly later




-- 
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 pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-871845140


   @Applenice Please take a look, the CI failed.


-- 
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 pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-870160159


   @Applenice 
   Need to add test in https://github.com/apache/apisix/blob/master/t/plugin/ip-restriction.t


-- 
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 pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-871828084


   You can use `string.rep`, like this one: https://github.com/apache/apisix/blob/d4c7fbbe831bc12c50ba63f00757f0eee14eae15/t/node/upstream-mtls.t#L100


-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r660209499



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -27,40 +27,29 @@ local lrucache  = core.lrucache.new({
 
 local schema = {
     type = "object",
-    oneOf = {
-        {
-            title = "whitelist",
-            properties = {
-                whitelist = {
-                    type = "array",
-                    items = {anyOf = core.schema.ip_def},
-                    minItems = 1
-                },
-                message = {
-                    type = "string",
-                    default = "Your IP address is not allowed"
-                },
-            },
-            required = {"whitelist"},
-            additionalProperties = false,
+    properties = {
+        message = {
+            type = "string",
+            minLength = 1,
+            maxLength = 64,

Review comment:
       64 looks too short to me. What about 4096?

##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -41,9 +41,10 @@ in CIDR notation like 10.10.10.0/24 can be used.
 | --------- | ------------- | ----------- | ------- | ----- | ---------------------------------------- |
 | whitelist | array[string] | optional    |         |       | List of IPs or CIDR ranges to whitelist. |
 | blacklist | array[string] | optional    |         |       | List of IPs or CIDR ranges to blacklist. |
+| message | string | optional    | Your IP address is not allowed. | [1, 64] | Message returned in case IP access is not allowed. |
 
-One of `whitelist` or `blacklist` must be specified, and they can not work
-together.
+One of `whitelist` or `blacklist` must be specified, and they can not work together.
+The message supports user-defined configuration.

Review comment:
       The message can be user-defined.




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659476630



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.
+
+```shell
+"plugins": {
+    "ip-restriction": {
+        "whitelist": [
+            "127.0.0.1",
+            "113.74.26.106/24"
+        ],
+        "message": "Do you want to do something bad?"

Review comment:
       Thanks, now I understand😊,previously ignored this place




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659425805



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -36,6 +36,10 @@ local schema = {
                     items = {anyOf = core.schema.ip_def},
                     minItems = 1
                 },
+                message = {

Review comment:
       I'll figure out how to modify it, thanks




-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659464617



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -36,6 +36,10 @@ local schema = {
                     items = {anyOf = core.schema.ip_def},
                     minItems = 1
                 },
+                message = {

Review comment:
       See https://github.com/apache/apisix/blob/07bfe5b9c03ad361cb71541eb02fd661f1323213/apisix/schema_def.lua#L33




-- 
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 merged pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #4493:
URL: https://github.com/apache/apisix/pull/4493


   


-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659404033



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.
+
+```shell
+"plugins": {
+    "ip-restriction": {
+        "whitelist": [
+            "127.0.0.1",
+            "113.74.26.106/24"
+        ],
+        "message": "Do you want to do something bad?"

Review comment:
       Need to update `Attributes`

##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.

Review comment:
       Use a custom message for what?

##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.
+
+```shell

Review comment:
       Should be json

##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -36,6 +36,10 @@ local schema = {
                     items = {anyOf = core.schema.ip_def},
                     minItems = 1
                 },
+                message = {

Review comment:
       Better to extract this field to avoid repeating 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



[GitHub] [apisix] Applenice commented on pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#issuecomment-871856016


   > @Applenice Please take a look, the CI failed.
   
   Yes, I saw `Failed tests:  2, 5, 8, 14, 17, 72`, I observed it when testing locally with `prove -Itest-nginx/lib -r t/plugin/ip-restriction.t`, I'll check the reason later


-- 
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 a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659463013



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.

Review comment:
       Err. Actually I mean we should write it more clear in the documentation, as the user won't have the same context as us.




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659477390



##########
File path: apisix/plugins/ip-restriction.lua
##########
@@ -36,6 +36,10 @@ local schema = {
                     items = {anyOf = core.schema.ip_def},
                     minItems = 1
                 },
+                message = {

Review comment:
       ok👌




-- 
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] Applenice commented on a change in pull request #4493: feat(ip-restriction): support user-defined configuration message

Posted by GitBox <gi...@apache.org>.
Applenice commented on a change in pull request #4493:
URL: https://github.com/apache/apisix/pull/4493#discussion_r659431742



##########
File path: docs/en/latest/plugins/ip-restriction.md
##########
@@ -70,6 +70,20 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 }'
 ```
 
+If you want to use a custom message, you can configure it in the plugin section.
+
+```shell
+"plugins": {
+    "ip-restriction": {
+        "whitelist": [
+            "127.0.0.1",
+            "113.74.26.106/24"
+        ],
+        "message": "Do you want to do something bad?"

Review comment:
       Sorry, I didn't understand😥, what does this attribute refer to?
   




-- 
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