HTTP_X_FORWARDED_FOR
| From: | Tobias Strau� | Date: | Sun, 09 Sep 2001 07:20:07 +0000 |
| Subject: | HTTP_X_FORWARDED_FOR | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66588@lists.php.net to get a copy of this message | ||
On php.net I found this:
When you use REMOTE_ADDR for getting the IP of the current user, sometimes
you get the IP of the ISP Cache server.
When this happens, the HTTP_X_FORWARDED_FOR is also set, it contains the IP
of the user.
[...]
Note that the X-Forwarded for header might contain multiple addresses, comma
separated, if the request was forwarded through multiple proxies.
[...]
My question is:
If the X-Forwarded for header contains multiple addresses, comma separated,
where do I find the one of the user? (I which order does it contain the
adresses?)
Do I get the right order (from the last proxies (at the beginning) to the
user itself (at the end)) when I do this:
$ip_route = $HTTP_SERVER_VARS["REMOTE_ADDR"] . "," .
$HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
So that I finally have a chronological sorted list (i know: a string that
contains the comma seperated ip-addresses of the users way to me (if they
were forwarded by the proxie))? Am I right?
Thanks for any coments about this.