Hi.
We would like to use a RewriteMap program to convert URLs which will then be
proxied. So far we have managed to create the relevant rewrite rule and a test
script that does what we want.
The only flaw in our plan is that there appears to be no way to handle if the
rewrite program stops running. I was hoping that in this situation the
RewriteRule would apply the right-hand side of the map (ie: key not found) but
unfortunately that side of the rule is ignored and we end up with the URL
/index.html being proxied. This is the type of rule I have tried:
RewriteRule ^/proxytest/(.*) ${proxymap:$1|/notfound.htm} [P]
What I would like to know is if there is a way to achieve our requirements via
the RewriteRule or if there is a better way to handle if the RewriteMap program
stops running.
I've also had a quick scan over the mod_rewrite source code and I think we
could probably customise the module to handle when it catches the failed case.
ie. Change
if (i == 4 && !strcasecmp(buf, "NULL")) {
return NULL;
}
to:
if ((i == 0) || (i == 4 && !strcasecmp(buf, "NULL"))) {
return NULL;
}
However, I would prefer to find a built-in solution to avoid having to build a
special module for Mac OS X, MS-Windows and Linux.
Thanks.
Kev.