IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New 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
Expand Edited by tuberculosis Aug. 21, 2007, 06:00:12 AM EDT
New Some sort of permissions issue??
New Don't think so
it runs the script OK - the calls happen at the right time, but the perl script reads lines from stdin and writes responses to stdout. What gets written to stdin is empty under apache.

If it were perms, I think the script would fail to run at all.



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
Expand Edited by tuberculosis Aug. 21, 2007, 06:00:53 AM EDT
New Try grouping
Try adding some parenthesis, so that the rewrite engine will know what $1 refers to.

RewriteRule ^/seaside/(.*)$ ${VOLLEY_BALL_SERVERS:$1} [P,L]

New Found it
$1 should have been $0




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
Expand Edited by tuberculosis Aug. 21, 2007, 06:03:45 AM EDT
     mod_rewrite hell - (tuberculosis) - (4)
         Some sort of permissions issue?? -NT - (Another Scott) - (1)
             Don't think so - (tuberculosis)
         Try grouping - (dws) - (1)
             Found it - (tuberculosis)

It is a silly place.
61 ms