Hi all,
When I create an assign message policy in the api proxy endpoitn preflow and set the header like this:
<Set><Headers><Headername="x-forwarded-for">{client.ip}</Header></Headers></Set>
When I run the trace UI, I can see the request header variable x-forwarded-for is setting proper client IP.
However, when I receive the request from the apigee in my backend service and log the request header, I am getting apigee message processors IP address rather than the client IP as I set in the set in the header.
Why this is happening and how do I resolve it?
Hi @Fazle Tanjil, have a look at this post,
https://community.apigee.com/articles/30998/getting-actual-client-ips-in-the-x-forwarded-for-h.html
Please try below,
<Set> <Headers> <Header name="x-forwarded-for">{request.header.x-forwarded-for}</Header> </Headers> </Set>
Thanks for the reply. I tried this one. Still the same. The funny thing is in the trace UI, the request header information shows that they are setting this value to request.header.x-forwarded-for with correct client IP.
But in my backend service (just console.log(req.headers) shows me that the x-forwarded-for header variable is the Apigee Message processor's IP. Like below:
The above is not the client ip.
Then maybe you should check this post,
https://community.apigee.com/articles/30998/getting-actual-client-ips-in-the-x-forwarded-for-h.html
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
1 |