Brian
Brian

Reputation: 307

Get users IP address that triggers a call from WSO2 API Manager

Is possible to get the users IP that triggered the API call on WSO2 API Manager and pass it on to the call?

Any help how to do this please

Upvotes: 0

Views: 482

Answers (1)

Sachini Rajapakse
Sachini Rajapakse

Reputation: 191

You can add following property before calling endpoint (before send mediator) to your api to get the ip of user

<property name="client_ip_address"
                   expression="get-property('axis2','REMOTE_ADDR')"
                   scope="transport"
                   type="STRING"/>

Since the scope is set to transport the client_ip_address is set as a header of outgoing message. You will be able to see something similar to below log when the wire is enabled.

[2016-01-21 15:44:10,187] DEBUG - wire << "client_ip_address: 172.22.99.122[\r][\n]"

Hope this will help you.

Upvotes: 3

Related Questions