Strange IP addresses in tomcat
- by mdev
Some where I have this in some generic class.
public static String getRequestIp (HttpServletRequest request){
String ipaddr = request.getHeader("X-FORWARDED-FOR");
if (ipaddr == null)ipaddr = request.getRemoteAddr();
return ipaddr;
}
For every request i call that method and in a certain moment i insert a record in a mysql database.
In most cases it works normally and i can see a record for every request with a valid ip address in the right field. But sometimes where the IP should be there is something like this. "unknown, 93.186.30.120" or "10.0.1.169, 186.38.84.3"
Apache is at the front listening at port 80 and used as proxy to Tomcat that listens at port 8081.
My router config would not allow to pass any conection that come by any port other than 80.
Any Help?
Thanks in advance.