mod_rewrite hell
I had this working once.
I'm using a dynamic rewrite map to do some load balancing. Using a little perl script to call a running process manager that brings stuff up and down. Proc mgr has a simple REST interface.
apache.conf fragment
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteMap VOLLEY_BALL_SERVERS prg:/Users/todd/bin/volley
RewriteRule ^/seaside/.*$ ${VOLLEY_BALL_SERVERS:$1} [P,L]
</IfModule>
volley is a perl script - dead simple and it works fine from the command line.
#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
my $cmd = $_;
open(MAP, "| curl [link|http://localhost:9550/rewriteMap?url=$cmd|http://localhost:955...writeMap?url=$cmd]");
while(<MAP>) {
print $_;
}
}
When I run volley from the cmd line, I can type urls and they get mapped like I expect.
%volley
cv
[link|http://foo/seaside/cv|http://foo/seaside/cv]
bar
[link|http://foo/seaside/bar|http://foo/seaside/bar]
When I let apache run it, it gets called, but $cmd is always empty. I can't see why that would be. Even weirder, sometimes volley gets/translates several lines of empty input for one request. Sometimes.
I'm stumped
We posture as apostles of fair play, as good sportsmen, as professional knights-errant-- and we throw beer bottles at the umpire when he refuses to cheat for our side...We save the black-and-tan republics from their native [statesmen]--and flood them with "deserving" democrats of our own. We deafen the world with our whoops for liberty--and submit to laws that destroy our most sacred rights...We play policeman and Sunday-school superintendent to half of Christendom--and lynch a darky every two days in our own backyard.
H.L. Mencken, 1914
mod_rewrite hell
I had this working once.
I'm using a dynamic rewrite map to do some load balancing. Using a little perl script to call a running process manager that brings stuff up and down. Proc mgr has a simple REST interface.
apache.conf fragment
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteMap VOLLEY_BALL_SERVERS prg:/Users/todd/bin/volley
RewriteRule ^/seaside/.*$ ${VOLLEY_BALL_SERVERS:$1} [P,L]
</IfModule>
volley is a perl script - dead simple and it works fine from the command line.
#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
my $cmd = $_;
open(MAP, "| curl [link|http://localhost:9550/rewriteMap?url=$cmd|http://localhost:955...writeMap?url=$cmd]");
while(<MAP>) {
print $_;
}
}
When I run volley from the cmd line, I can type urls and they get mapped like I expect.
%volley
cv
[link|http://foo/seaside/cv|http://foo/seaside/cv]
bar
[link|http://foo/seaside/bar|http://foo/seaside/bar]
When I let apache run it, it gets called, but $cmd is always empty. I can't see why that would be. Even weirder, sometimes volley gets/translates several lines of empty input for one request. Sometimes.
I'm stumped
We posture as apostles of fair play, as good sportsmen, as professional knights-errant-- and we throw beer bottles at the umpire when he refuses to cheat for our side...We save the black-and-tan republics from their native [statesmen]--and flood them with "deserving" democrats of our own. We deafen the world with our whoops for liberty--and submit to laws that destroy our most sacred rights...We play policeman and Sunday-school superintendent to half of Christendom--and lynch a darky every two days in our own backyard.
H.L. Mencken, 1914