Marco-Zheng opened a new issue #4470:
URL: https://github.com/apache/apisix/issues/4470
### Issue description
I have configured "X-Forwarded-For" in proxy-rewrite:
"$proxy_add_x_forwarded_for"
In order to get the Real IP, per we used K8S, so the IP would be transferred
to the clusterIP of K8S, but we could not get this value, and X-real-IP was
always obtained from the clusterIP of K8S.
### Environment
* apisix version (cmd: `apisix version`): 2.6
### Minimal test code / Steps to reproduce the issue
1.add plugin in service
```
"plugins": {
"proxy-rewrite": {
"disable": false,
"headers": {
"ENV": "pre",
"Host": "$host",
"X-Forwarded-For": "$proxy_add_x_forwarded_for"
},
"regex_uri": [
"/api/scrm/(.*)",
"/common-rest/$1"
]
}
}
```
2.print the header for X-Forwarded-For

the ip for 172.19... is k8s clusterip, 220.249.. is correct real ip, but
X-Forwarded-For is null and X-Real-IP is 172.19.. which is not correct real ip,
i also try to configure like this `"X-Real-IP": "$proxy_add_x_forwarded_for"`,
I expect to get the result like this `220.249.., 172.19...`(got two ip),
actually i got only one ip `172.19...`
below is the log for apisix, show correct ip which i expect for

3. so i guess the X-Real-IP/X-Forwarded-For was rewrite by apisix
i also checked the config-default.yaml, not sure if below configuration will
influence the result, i try to add the ip
172.19.0.0 in order to filter the incorrect k8s ip segment, but doesn't work

### What's the actual result? (including assertion message & call stack if
applicable)
`172.19...`
### What's the expected result?
`220.249.., 172.19...`
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]