#!/usr/bin/perl
#
# mod_perl startup file. 
#
# This file is used for pre-loading perl code for use under 
# Apache::Registry, or for creating mod_perl handlers. See:
#
#       http://perl.apache.org/guide/
#
# for more information.
#

use lib '/home/slowtwitch/forum.slowtwitch.com/cgi-bin/admin';
use GForum::mod_perl;

# Automatically fix up the REMOTE_IP environment variable.

sub My::ProxyRemoteAddr ($) {
# ------------------------------------------------
    my $r = shift;
    my $ip = $r->connection->remote_ip;
    unless ($ip eq '127.0.0.1') {
        return OK;
    }
# Select last value in the chain -- original client's ip
    if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/) {
        $r->connection->remote_ip($ip);
    }
    return OK;
}


# Must return a true value
1;

