For obtaining originating Client IP address,X-forwarded-for is usually used.But in http log file,I saw something like this example: client_ip=1.1.1.1 x-forwarded-for=2.2.2.2 is there any difference between these two IP's?
-
Please refer to the following StackOverflow article: https://stackoverflow.com/questions/7445592/what-is-the-difference-between-http-client-ip-and-http-x-forwarded-for – JoshuaSmeda Oct 28 '19 at 05:17
1 Answers
Client IP is the IP of the request whereas X-Forwarded-For is an IP that has been set by someone in the header. Most common usage example is a reverse proxy: Client IP is then the IP of the reverse proxy (e.g. localhost). Therefore a typical reverse proxy configuration would send X-Forwarded-For to the IP of the original address, so that you can identify where the request was originally coming from.
However, it is also possible for the requester to set X-Forwarded-For to any arbitrary IP. In some use cases this can help to bypass geo-restrictions (e.g. for IPTV). So requester from Country A (that is geo-restricted) sets X-Forwarded-For to IP from Country B (that is not restricted). IPTV delivers content assuming original requester is from country B.

- 21
- 3