Layer 7 API Management

Expand all | Collapse all

How to log IP-address of a system when the gateway is under load balancer

Jump to Best Answer
  • 1.  How to log IP-address of a system when the gateway is under load balancer

    Posted 04-11-2019 03:19 AM

    Hi,

     

    This is Madhavi.
    The clustered Gateway is under the load-balancer. Now i wanted to log the Ipaddress of the API requester(System IPaddress to know who is actually requesting the service). I tried to use the context variable ${request.tcp.remoteAddress}, but this is actually giving the load balancer IPaddress. In these case how can i get the IP of an requester.

    If someone can help me out in these, it would be helpful to me

     

    Thanks,
    Madhavi Putta



  • 2.  Re: How to log IP-address of a system when the gateway is under load balancer
    Best Answer

    Posted 04-11-2019 03:24 AM

    You probably need the "X-forwarded-for" header as (hopefully) set by the preceding load balancer or firewall. 

     

    Something like the following:   Appending to the X-forwarded-for request.http header 

     

    Cheers - Mark



  • 3.  Re: How to log IP-address of a system when the gateway is under load balancer

    Posted 04-16-2019 06:18 AM

    Mark, you get the point.

     

    We asked to the load balancer guys to forward te XFF header to API Gateways and we solved the problem.

    Please note that is possible to add XFF header only if the balancer is setup in "HTTP mode".

     

    Cheers, Roberto