[users@httpd] Problem with rewrite round robin lb.pl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Hoping someone may help.

I have the following in httpd.conf (changed domain to 'mydomain').

<VirtualHost * >
       ServerName www.mydomain.com
       RewriteEngine On
       RewriteMap    lb      prg:/etc/httpd/conf/lb.pl
       RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]
       #RewriteRule ^/(.*) hello$1 [P,L]
</VirtualHost>

Which will rewrite fine for the commented out 'hello' test (so the rule is being hit for the virtual host). So everything is working fine EXCEPT the lb.pl script.

I have the lb.pl cut and paste from the apache manual with only minor mods (the script executes as a non priv user fine and returns a URL when run interactively that when browsed to works just fine).

#!/usr/bin/perl
##
##  lb.pl -- load balancing script
##


$| = 1;

$name   = "b";     # the hostname base
$first  = 1;         # the first server (not 0 here, because 0 is myself)
$last   = 2;         # the last server in the round-robin
$domain = "mydomain.com"; # the domainname
# Zope rewrite
$vhost = ":8080/VirtualHostBase/http/www.mydomain.com:80/biol2/VirtualHostRoot";

$cnt = 0;
while (<STDIN>) {
    $cnt = (($cnt+1) % ($last+1-$first));
    $server = sprintf("%s%d.%s%s", $name, $cnt+$first, $domain, $vhost);
    print "http://$server/$_";;
}
##EOF##


BUT for some reason the lb rewrite rule always proxys to / even though the script will return valid, browsable URLs when run from the command line.

In the rewrite log I get
 (2) init rewrite engine with requested uri /
 (3) applying pattern '^/(.+)$' to uri '/'
 (1) pass through /

The 'hello' test rule gets
(1) go-ahead with proxy request proxy:http://www.mydomain.com/hellohellohellohellohellohellohellohellohellohellohellohello [OK]


Any help would be much appreciated.

Drew Nichols








---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux