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 2022/06/06 14:22:42 UTC

[GitHub] [apisix] Qizhd commented on a diff in pull request #7197: docs: add re case on response-rewrite plugin

Qizhd commented on code in PR #7197:
URL: https://github.com/apache/apisix/pull/7197#discussion_r890201820


##########
docs/en/latest/plugins/response-rewrite.md:
##########
@@ -118,6 +118,45 @@ X-Server-balancer_addr: 127.0.0.1:80
 {"code":"ok","message":"new json body"}
 ```
 
+Replace the string client_addr of body to client_addr_replace.
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+  "plugins": {
+    "response-rewrite": {
+            "headers": {
+                "X-Server-id": 3,
+                "X-Server-status": "on",
+                "X-Server-balancer_addr": "$balancer_ip:$balancer_port"
+            },
+            "filters": [{"regex": "client_addr", "scope": "global", "replace": "client_addr_replace"}],
+            "vars":[
+                [ "status","==",200 ]
+            ]
+    }
+  },
+  "upstream": {
+    "type": "roundrobin",
+    "nodes": {
+      "127.0.0.1:8881": 1

Review Comment:
   updated



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