Probably me, I know

I am working on settinig up a 2 server/proxy config. I have followed instructions at 
http://perl.apache.org/docs/1.0/guide on how to do that and so far it has gone pretty 
well. I now have both servers built from apache 1.3.27 and  mod_perl 1.27 for the 2nd 
server.

The issue is I am trying to add mod_proxy_add_forward so the originating IP address 
shows up in the MP server's logs. The thing that is strange to me is that it works 
fine if I put the machine's internal address, (which happens to be 192.168.1.201) in 
my startup.pl file:
-----------------------------------
#!/usr/bin/perl   
use Apache::Constants ();

sub My::ProxyRemoteAddr ($) {
    my $r = shift;

# we'll only look at the X-Forwarded-For header if the requests
# comes from our proxy at localhost
#return OK unless ($r->connection->remote_ip eq "127.0.0.1");
return OK unless ($r->connection->remote_ip eq "192.168.1.201");

if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
  $r->connection->remote_ip($ip);
}

return OK;
  }

1;
-----------------------------------
but if I use 127.0.0.1, then 192.168.1.201 shows up in the MP server's logs.

some more info on my set up
- 127.0.0.1 is in the /etc/hosts file:
127.0.0.1       localhost

even if I change that to: (which doesn't strike me as a good idea (tm) anyway)
127.0.0.1       localhost development

it does not change things.

Can anyone help me out with what I am missing here?

I could live with the weirdness in startup pl but I would rather not because it is one 
more config to have to keep track of, and it will break if the machine's IP address 
changes.

Thanks and have some holiday egg nog on me!

GV

Reply via email to