Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting wrong ip address in java  RSS feed

 
Srinivas Kalleti
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sending request from my machine to server. Ip address of my machine is 192.168.1.217.

At server side I am printing the client Ip address, but when I am printing Ip address with request.getRemoteAddr() I am getting it as 192.168.0.5.

When I am printing Ip address with request.getHeader("X-FORWARDED-FOR") I am getting it as null.

I am using apache tomcat server.
 
Ron McLeod
Saloon Keeper
Posts: 1426
206
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are the client and the server networked? Are they on different subnets with one or more routers between? Any HTTP proxies in the path?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!