Gossamer Forum
Home : General : Perl Programming :

Detect if user is accessing script via a proxy.

Quote Reply
Detect if user is accessing script via a proxy.
What I have is a script that allows users to submit one url a day. The script tracks users by IP address as well as a cookie. I am now having problems with users deleting the cookie and submitting to the form again via a HTTP proxy. Is there any way at all to detect that the user is accessing the script via an anonymous proxy?
Quote Reply
Re: [BennyHill] Detect if user is accessing script via a proxy. In reply to
Not that I know of.

Not apart from matching the user-agent or remote host against a list of known proxies.
Quote Reply
Re: [BennyHill] Detect if user is accessing script via a proxy. In reply to
Code:
my $ip = $ENV{'REMOTE_ADDR'};
my $realIp = $ENV{'HTTP_X_FORWARDED_FOR'};
(($realIp eq "unknown") or ($ip eq $realIp) or !$realIp)
? print $ip
: print "$realIp (via $ip)";
Quote Reply
Re: [sh2sg] Detect if user is accessing script via a proxy. In reply to
That's not totally reliable as not all proxy servers use that header.

Some other headers that can be used to check though are:

http://www.proxybench.com/...cles/httpheaders.asp

Last edited by:

Paul: Nov 13, 2002, 1:08 PM