Strange IP addresses in tomcat
Posted
by
mdev
on Stack Overflow
See other posts from Stack Overflow
or by mdev
Published on 2012-07-01T19:11:16Z
Indexed on
2012/07/01
21:16 UTC
Read the original article
Hit count: 219
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.
© Stack Overflow or respective owner