I have an android app that makes a simple REST call to my backend server (Google App Engine [GAE]). On my GAE, I am trying to extract the IPv4 address of the connection and I always get a IPv6 address.
I'm using this to extract the ipAddress. In addition, I have checked that all functions from ClientInfo return either NULL or IPv6 address.
Any suggestions?
ip = headers.getFirstValue("X-FORWARDED-FOR");
if (ip == null || ip.equals("")) {
ClientInfo clientInfo = request.getClientInfo();
ip = clientInfo.getAddress();
}
else
{
ClientInfo clientInfo = request.getClientInfo();
LOG.info("X-FORWARDED-FOR IP:"+ip+" Other IP:"+clientInfo.getAddress());
}