I added a perl handler to my apache setup and I can't understand why I'm
losing the directory listings in my image and doc directories. I need
to both squelch rougue web querries
The apache conf looks like this:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/usr/local/apache/htdocs/brooklyn"
ServerName brooklyn-living.com
DirectoryIndex index.html
PerlModule Embperl
Embperl_UseEnv on
ErrorLog logs/brooklyn_error_log
CustomLog logs/brooklyn_access_log common
<Directory /usr/local/apache/htdocs/brooklyn>
Options Indexes ExecCGI
DirectoryIndex index.html
<Files *.html>
SetHandler perl-script
PerlResponseHandler URL_BLOCK
PerlHandler Embperl
</Files>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory /usr/local/apache/htdocs/brooklyn/images>
Options Indexes FollowSymLinks
SetHandler perl-script
PerlResponseHandler URL_BLOCK
</Directory>
</VirtualHost>
and the URL_BLOCK script looks like this:
package URL_BLOCK;
use strict;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(:common);
sub handler{
my $r = shift;
my $gate = $r->unparsed_uri;
print STDERR "YO $gate\n";
return Apache2::Const::DECLINED unless defined $gate;
if ($gate =~ m{///}){
print STDERR "I have a match\n";
$r->log_reason("Access Forbidden", $r->filename);
return Apache2::Const::FORBIDDEN;
}
return Apache2::Const::DECLINED;
}
1;