'How can I get client IP in IBM MobileFirst8

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vivin K