I'm porting an IIS asapi filter over to linux/apache, and am wondering what the best path to take it. On IIS, this isapi filter intercepts the request, performs a database lookup to find the file the user is requesting, and then rewrites the URL to directly serve that file.
What is the best way to do this on Apache? mod_rewrite doesn't seem to have a facility to interject user code to perform a database lookup, so we can't use that. We can't use the mod_isapi since our DLL is a filter and the module doesn't support that.
Right now, I'm thinking the most straightforward way is to write our own C module, using the mod_rewrite code as a guide. I'd like to avoid that if I can. I also don't want to have to issue an HTTP redirect for each request via a perl/PHP/whatever script since performance will suffer with the redirect.
Suggestions? Can we use Apache handlers or filters to accomplish this?