Say an instance of WSO2's API Manager receives API calls from an external client, it is possible to pass the caller's IP address to the backend (in the header for example, other solutions are welcome too)? If yes how?
Asked
Active
Viewed 1,509 times
4

Abimaran Kugathasan
- 31,165
- 11
- 75
- 105

Jérôme Verstrynge
- 57,710
- 92
- 283
- 453
-
Possible duplicate of [WSO2 Api Manager log Http request in log mediator](http://stackoverflow.com/questions/36719129/wso2-api-manager-log-http-request-in-log-mediator) – Abimaran Kugathasan Aug 29 '16 at 10:26
1 Answers
7
HTTP Header is the way to do it. You can create a sequence like this and attach to API.
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="sample">
<property name="client_ip" expression="get-property('axis2', 'REMOTE_ADDR')" scope="transport"/>
</sequence>
If you have a proxy before API Manager, you may not be able to identify the real client using REMOTE_ADDR
. It will be the IP of the proxy. In such cases you can use X-Forwarded-For
http header.

Bee
- 12,251
- 11
- 46
- 73