Getting client static IP address <p>I am deplyong a web application in the Internet and I am checking whether the user's login is valid by checking its client IP address (e.g. <em>192.168.2.XXX</em>). Actually, I have found a working code (below). This code was completely working before, but after some time, its output is not the same anymore. Now, this code only gives me 1 IP address which is the server's IP address. What is wrong with my code? How can I get the client's static IP address rather than the server's IP address? I have also tried other solutions such as <code>getRemoteAddr()</code> and <code>request.getHeader("PROXY-CLIENT-IP")</code> but it is not working.</p> <p>Java:</p> <pre><code>String ipAddress = request.getHeader("X-FORWARDED-FOR"); if(ipAddress == null) ipAddress = InetAddress.getLocalHost().getHostAddress(); </code></pre>