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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With