java - Strange IP addresses in tomcat -


this question has answer here:

some have in 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 call method , in moment insert record in mysql database.

in cases works , can see record every request valid ip address in right field. ip should there this. "unknown, 93.186.30.120" or "10.0.1.169, 186.38.84.3" apache @ front listening @ port 80 , used proxy tomcat listens @ port 8081. router config not allow pass conection come port other 80. help? in advance.

the format x-forwarded-for http header is:

x-forwarded-for: client, proxy1, proxy2, ... 

thus

unknown, 93.186.30.120  

means request coming proxy @ 93.186.30.120, originating unknown local address; ,

10.0.1.169, 186.38.84.3 

similarly means, request 186.38.84.3 proxy, coming local ip 10.0.1.169


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -