How can I get client IP in IBM MobileFirst8

121 Views Asked by At

I use MFP.Server.getClientRequest().getRemoteAddr() API in adapter

but it get WebServer(IHS) IP not client IP

I know its mean last proxy ip

How can I get client actual IP?

1

There are 1 best solutions below

0
On

You can take one of two approaches:

  1. If the Webserver sets a X-Forwarded-For header, then use MFP.Server.getClientRequest().getHeader("X-Forwarded-For") , to obtain the client IP.
  2. Capture the client IP in the client-side ( mobile) code and embed it in the request payload that fires. Obtain this value in the IBM MobileFirst Javascript code.