Layer7 API Management

Expand all | Collapse all

Retrieve Client IP and Pass to Back-End

Jump to Best Answer
  • 1.  Retrieve Client IP and Pass to Back-End

    Posted 09-14-2016 05:36 AM

    Hi, 

     

    I have a back-end service which checks the registered IP address for validation, upon routing the the service via CA Layer 7 gateway the request IP is now always of gateway. I would like to know how to capture ip address of the client in Layer 7 and pass it to back-end services.

     

    Thanks in advance,

    Vinith.



  • 2.  Re: Retrieve Client IP and Pass to Back-End

    Posted 09-14-2016 11:08 AM

    You can capture the IP address the message was sent to the Gateway on by using the variable ${request.tcp.remoteIP} 

     

    Transport Layer Context Variables - CA API Gateway - 9.0 - CA Technologies Documentation 



  • 3.  Re: Retrieve Client IP and Pass to Back-End

    Posted 09-14-2016 11:17 AM

    Thank you!



  • 4.  Re: Retrieve Client IP and Pass to Back-End
    Best Answer

    Posted 09-14-2016 11:11 AM

    ${<target >.tcp. remoteAddress} -or- ${<target >.tcp. remoteIP} : 
    Either of these variables returns the remote IPv4 or IPv6 address of the TCP connection through which the Message arrived, in conventional (dotted or colon) notation, or null if not known.

     

    ${<target >.tcp.remoteHost} : By default, this returns the IP address of the client (same as "*.tcp.remoteIP"). To return the hostname, enable lookups must be configured/enabled.

     

    From here, you could use an HTTP "X-Forwarded-For" header to send the details onto your target.



  • 5.  Re: Retrieve Client IP and Pass to Back-End

    Posted 09-14-2016 11:17 AM

    Thanks! this works well. Need minor modification at back-end side.