Geoffrey Young wrote: >>********** >>mod_perl-1.99_16-3 >>********** >>DirectoryIndex index.pl > > > please see this thread > > http://marc.theaimsgroup.com/?t=111335099400001&r=1&w=2 > > specifically the solution found here > > http://marc.theaimsgroup.com/?l=apache-modperl&m=111445150218566&w=2 > > if this keeps coming up I might consider adding the My::Fixup code to > mp2core as Apache2::DirectoryFixup like in the attached patch (with > documentation, of course :)
I should add a bit of clarification at this point... if you read through the above thread completely you'll see an analysis of what happens when using SetHandler + DirectoryIndex - basically, mod_dir is never able to apply the DirectoryIndex directive because it never enters the request. however, it is possible to get DirectoryIndex working without the PerlFixupHandler in that thread... consider this configuration Alias /dirindex /usr/local/apache2/cgi-bin <Location /dirindex> AddHandler perl-script .pl Options +ExecCGI PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders DirectoryIndex cgi.pl </Location> which works perfectly well. in fact, I just commited a test to the mod_perl test suite that proves it :) what happens here is 1a. a request comes in to /dirindex/ 2a. mod_mime sees that r->filename a directory and sets the response handler to DIR_MAGIC_TYPE 3a. at the fixup phase, mod_dir sees the DIR_MAGIC_TYPE, applies the DirectoryIndex directive, and issues an internal redirect to cgi.pl 4a. cgi.pl is associated with perl-script during the internal redirect 5a. mod_perl handles cgi.pl now, contrast that configuration with a typical registry setup Alias /dirindex /usr/local/apache2/cgi-bin <Location /dirindex> SetHandler perl-script Options +ExecCGI PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders DirectoryIndex cgi.pl </Location> this time 1b. a request comes in to /dirindex/ 2b. mod_mime sees that r->filename a directory and sets the response handler to DIR_MAGIC_TYPE 3b. SetHandler, no longer owned by mod_mime, steps in, overrides this, and sets the response handler to perl-script 4b. at the fixup phase, mod_dir sees perl-script and returns DECLINED without applying DirectoryIndex 5b. mod_perl dispatches out to ModPerl::Registry 6b. Registry doesn't find a file to process, since r->filename is a directory, and returns DECLINED 7b. apache falls back to default-handler, which doesn't know what to do with a directory either, issues an error in error_log and returns 404 the PerlFixupHandler I pointed to before essentially creates step 3.5b 3.5b. the PerlFixupHandler, which runs before mod_dir in the fixup phase, sees that the registered response handler is perl-script but that $r->filename is a directory, and re-sets the response handler to DIR_MAGIC_TYPE which makes the next pathway 3a instead of 4b. anyway, there are other possible outcomes, of course, depending on your particular setup. but hopefully this illustrates the exact nature of the problem and what you can do to get things working the way you want to. HTH --Geoff