kayx23 commented on issue #9433: URL: https://github.com/apache/apisix/issues/9433#issuecomment-1549431136
## TEST: Plugins Enabled in Two Separate Global Rule First, create a route pointing to httpbin.org `/anything` ``` curl "http://127.0.0.1:9180/apisix/admin/routes" -H "X-API-KEY: xxxx" -X PUT -d ' { "id": "getting-started-anything", "uri": "/anything", "upstream" : { "type": "roundrobin", "nodes": { "httpbin.org": 1 } } }' ``` Create two global rules: ``` $ curl http://127.0.0.1:9180/apisix/admin/global_rules/1 -H "X-API-KEY: xxxx" -X PUT -d '{ "id":"1", "plugins":{ "real-ip":{ "source": "http_x_forwarded_for" } } }' {"key":"/apisix/global_rules/1","value":{"update_time":1684233963,"plugins":{"real-ip":{"source":"http_x_forwarded_for","recursive":false}},"create_time":1684229345,"id":"1"}} $ curl http://127.0.0.1:9180/apisix/admin/global_rules/2 -H "X-API-KEY: xxxx" -X PUT -d '{ "id":"2", "plugins":{ "ip-restriction":{ "whitelist":[ "10.140.0.2", "172.17.0.1", "172.18.0.1" ], "message": "Your IP address is not allowed" } } }' {"key":"/apisix/global_rules/2","value":{"update_time":1684233969,"plugins":{"ip-restriction":{"whitelist":["10.140.0.2","172.17.0.1","172.18.0.1"],"message":"Your IP address is not allowed"}},"create_time":1684233969,"id":"2"}} ``` Curl to the endpoint to see if the request goes through: ``` $ curl "http://127.0.0.1:9080/anything" -H "x_forwarded_for: 100.123.1.16" { "args": {}, "data": "", "files": {}, "form": {}, "headers": { "Accept": "*/*", "Host": "127.0.0.1", "User-Agent": "curl/7.74.0", "X-Amzn-Trace-Id": "Root=1-64635f62-761ff0fb389ff1102fc89eda", "X-Forwarded-Host": "127.0.0.1" }, "json": null, "method": "GET", "origin": "172.18.0.1, 34.81.252.224, 100.123.1.16", "url": "http://127.0.0.1/anything" } ``` The request went through; the returned result showed `100.123.1.16` as one of the origins. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
