Problem with JSP getRemoteAddress

I would like to know how to get the IP address of a client who visits my web pages. JSP page content:

<% out.print( request.getRemoteAddr() + "<br>"); out.print( request.getRemoteHost() ); %> 

Exit:

 0:0:0:0:0:0:0:1 0:0:0:0:0:0:0:1 
+2
source share
1 answer

"0: 0: 0: 0: 0: 0: 0: 1" is the IPv6 feedback address as defined in RFC 3513 .

It looks like your OS and application server are configured to use IPv6 and that you are viewing the page from the local machine.

By the way, calling getRemoteAddress () will not provide you with the IP address of the client. There may be intermediate nodes on the network whose address you can get. This is especially true for proxies and load balancers.

+6
source

Source: https://habr.com/ru/post/921461/


All Articles