Posted: 13 Aug 2020 2:27 EDT Last activity: 31 Aug 2020 14:00 EDT
How to get user IP Address
I have requirement to get User IP Address. In Pega, I can use pxRequestor.pxRemoteAddr to get it, but if I implement Load Balancer on my architecture, the value of that property is IP of Load Balancer, not IP of client. Anyone can help me ?
***Edited by Moderator Marissa to update General to Product***
You can try retrieving the value of X-Forwarded-For or Forwarded HTTP headers during authentication (it isn't available outside of authentication). However if any proxy between the user and the Pega app server doesn't set this properly you won't be able to identify the true source IP.
The headers aren't required, so you won't be able to assume that they always exist or contain accurate information. Many companies would strip this data as it passes through a proxy for security or privacy reasons.
There are some examples of fetching header values using a java step, for example: