smali
smali

Reputation: 4805

X-FORWARDED-FOR will give the exact client IP or the IP given by NAT

Is there any way to get the exact client IP of http request.

If I use X-FORWARDED-FOR

<%= request.getHeader("X-FORWARDED-FOR") %>

Then I will get the exact IP of client not proxies but again there are exceptions to this that is there are plugins available that forge the false IP's.

So My question is,

Is the X-FORWARDED-FOR will give the exact client IP or the IP given by NAT.

Upvotes: 1

Views: 2184

Answers (1)

Stephen C
Stephen C

Reputation: 719006

Is the X-FORWARDED-FOR will give the exact client IP or the IP given by NAT.

It depends on the proxy, how it is configured, and whether it knows the real IP address. For example, if the proxy is logically outside of the NAT, then it will only see "NATed" IP addresses.

I would not rely on the IP addresses being real (or not) ... unless you know the details of the specific proxy.

Upvotes: 3

Related Questions