in reply to HTTP::Proxy and X-Forwarded-For headers
That header:
is the correct order as each proxy effectively appends to this string. See mod_extract_forwarded for background....X-Forwarded-For: client, proxy1, proxy2,.....
What appears to have happened is that you have successfully removed the XFF header and added in your supplied IP as the client. I expect that the two instances of 10.0.0.50 are succesively added by HTTP::Proxy and then Apache2 *after* this point. This is expected, as is the order. But this should not matter per se as the client is the leftmost IP (you may choose to ignore anything to the left of a trusted proxy as they could just be spoofing). You could fix the problem simply by adding a mod_extract_forwarded handler and making 10.0.0.50 'trusted', but......
It *seems* your expectation is that the originating client (for geotargetting) is the right most entity. This is wrong. It is the left most IP in the list. FWIW this snippet comes from some of our code:
my $ip = $ENV{'HTTP_X_FORWARDED_FOR'} || $ENV{'REMOTE_HOST'} || $E +NV{'REMOTE_ADDR'}; # HTTP_X_FORWARDED_FOR may be 'xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx' # originating client is left most IP. this split patches issues as + some proxies # add space after IP and before , ($ip) = split /\s*,/, $ip;
cheers
tachyon
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: HTTP::Proxy and X-Forwarded-For headers
by cleverett (Friar) on Sep 13, 2004 at 22:30 UTC | |
by tachyon (Chancellor) on Sep 13, 2004 at 22:37 UTC | |
by cleverett (Friar) on Sep 13, 2004 at 22:43 UTC | |
by tachyon (Chancellor) on Sep 13, 2004 at 22:49 UTC | |
by cleverett (Friar) on Sep 14, 2004 at 05:15 UTC | |
|