httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Nichols <>
Subject [users@httpd] Problem with rewrite round robin
Date Mon, 23 May 2005 05:21:00 GMT
Hoping someone may help.

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

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

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 script.

I have the 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).

## -- 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 = ""; # the domainname
# Zope rewrite
$vhost = 

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

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 


Any help would be much appreciated.

Drew Nichols

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message