You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/03/08 05:57:42 UTC

[incubator-apisix] branch master updated: doc: modify ip restrictions plugin doc. (#1219)

This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ebfa24  doc: modify ip restrictions plugin doc. (#1219)
4ebfa24 is described below

commit 4ebfa247876c2af9b5ee0ad8374a2bd23736dcb7
Author: Ayeshmantha Perera <ak...@apache.org>
AuthorDate: Sun Mar 8 06:57:31 2020 +0100

    doc: modify ip restrictions plugin doc. (#1219)
---
 doc/plugins/ip-restriction.md | 51 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/doc/plugins/ip-restriction.md b/doc/plugins/ip-restriction.md
index d6e0698..ddec474 100644
--- a/doc/plugins/ip-restriction.md
+++ b/doc/plugins/ip-restriction.md
@@ -87,11 +87,58 @@ HTTP/1.1 403 Forbidden
 {"message":"Your IP address is not allowed"}
 ```
 
+## Change the restriction
+
+When you want to change the whitelisted ip, it is very simple,
+you can send the corresponding json configuration in the plugin configuration,
+no need to restart the service, it will take effect immediately:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "ip-restriction": {
+            "whitelist": [
+                "127.0.0.2",
+                "113.74.26.106/24"
+            ]
+        }
+    }
+}'
+```
+
+## Test Plugin after restriction change
+
+Requests to `127.0.0.2`:
+
+```shell
+$ curl http://127.0.0.2:9080/index.html
+HTTP/1.1 200 OK
+...
+```
+
+Requests to `127.0.0.1`:
+
+```shell
+$ curl http://127.0.0.1:9080/index.html -i
+HTTP/1.1 403 Forbidden
+...
+{"message":"Your IP address is not allowed"}
+```
+
+
 ## Disable Plugin
 
 When you want to disable the `ip-restriction` plugin, it is very simple,
- you can delete the corresponding json configuration in the plugin configuration,
-  no need to restart the service, it will take effect immediately:
+you can delete the corresponding json configuration in the plugin configuration,
+no need to restart the service, it will take effect immediately:
 
 ```shell
 $ curl http://127.0.0.1:2379/v2/keys/apisix/routes/1 -X PUT -d value='