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 08:53:54 UTC

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

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


##########
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:
   `httpbin.org` is recommended, no one knows what `127.0.0.1:8881` will respond 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