Re: mod_proxy_add_forward weirdness: is it me or is it the code?

2002-12-23 Thread George Valpak
Solving my own problem so y'all don't have to :)

- Looks like in my front end server, i need a rewrite rule like this:

RewriteRule ^/(.*.cgi)$ http://localhost:8000/$1 [proxy]

- then, in the backend server, I made the servename= localhost :
ServerName localhost

- then, for each proxy virtual host that corresponds to a virtual host on the front 
end, I make the backend virtual host look like this:
VirtualHost localhost:8000
 -- config stuff --
/VirtualHost

- Before I had the Virtual Host names correspond on both servers - now it looks like 
all the back end virtual hosts will be on localhost, with a different port for each

Question: Not a big issue in my case, but it could be on others with zillions of 
backend proxys: is there a recommended place to find free port #s to assign beyond 
the traditional 8000, 8001, 8080, and maybe 81?

- I updated my startup.pl to add the X-Forwarded-For header when the request comes 
form localhost (127.0.0.1):

return OK unless ($r-connection-remote_ip eq 127.0.0.1);
#return OK unless ($r-connection-remote_ip eq 192.168.1.201);

Happy Holidays to everyone!

GV

At 05:41 PM 12/22/2002 -0800, George Valpak wrote:
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:

snip




mod_proxy_add_forward weirdness: is it me or is it the code?

2002-12-22 Thread George Valpak
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