[sclug] The SCLUG survey !!!

Alan Pearson alandpearson at yahoo.com
Mon Feb 14 18:40:49 UTC 2005


Here we go again on the merry go round...
I've made a change :

$q = new CGI ;
$ipFwdFor = $q->http('HTTP_FORWARDED_FOR') ;
$ipXFwdFor = $q->http('X_HTTP_FORWARDED_FOR') ;

if ( $ipFwdFor ) {
        $ipaddr = $ipFwdFor ;
} elsif ( $ipXfwdFor ) {
        $ipaddr = $ipXFwdFor ;
} else {
        $ipaddr = remote_host() ;
}


You can see that it now uses whichever ip addr it finds first, searching 
FwdFor, XFwdFor and then real ip address.

Could you guys who were having trouble before try it and let me know ?

Thanks !
AlanP



On Monday 14 February 2005 11:47, Damion Yates wrote:
> On Mon, 14 Feb 2005, Alan Pearson wrote:
>
> [snipped]
>
> > I'll check to see if HTTP_FORWARDED_FOR is set and if not check
> > REMOTE_ADDR.
>
> I believe our apache servers convert X-Http-Forwarded-For: in to
> X_HTTP_FORWARDED_FOR as an environment variable not
> "HTTP_FORWARDED_FOR" as mentioned above.  Of course you'll be printing
> %ENV while debugging to work this out anyway, just thought I'd add.
>
> For the BBC (now Siemens) people who may vote (is anyone adding the
> email votes or do I need to vote again?) we're likely to need this
> code as we only have a small set of outgoing proxy IPs and I know our
> proxy software does sent the HTTP header X-Http-Forwarded-For.
>
> Thanks,
>
> Damion

-- 
AlanP


More information about the Sclug mailing list