You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Geoffrey Young <gy...@laserlink.net> on 2001/04/18 20:49:40 UTC

RFC: Apache::ReverseLocation

Hi all...

  well, I put some more work into it and have overcome a few issues (like
restoring $r->filename and making vhosts work)...

  anyway, I would be interested if anyone gets the chance to work with it or
deem it worthy of future development...

--Geoff

http://morpheus.laserlink.net/~gyoung/modules/Apache-ReverseLocation-0.01.ta
r.gz

README:

NAME

Apache::ReverseLocation - provide for negative URI containers

SYNOPSIS

httpd.conf:

  PerlModule Apache::ReverseLocation

  <Location !~ "/foo">
    SetHandler perl-script
    PerlHandler My::Handler
  </Location>

  Alias !~ /bar /usr/local/apache/somefiles
  <LocationMatch !~ "/bar">
    SetHandler perl-script
    PerlHandler Another::Handler
  </LocationMatch>

DESCRIPTION

Apache::ReverseLocation provides negative matching for <Location> and
<LocationMatch> container directives.  They work in the same manner as
the default directives except that the sense of the match is reversed,
similar to Perl's built-in !~ operator, allowing you to set the
behavior of your containers as restrictive instead of permissive.

Apache::ReverseLocation also overrides the mod_alias directive Alias,
which makes it possible to restore the filename (if you need it)
even though the URI is incorrect when translation occurs.  Hopefully
it actually works.

EXAMPLE

  in httpd.conf:

    PerlModule Apache::ReverseLocation

    <Location !~ "/perl-bin|cgi-bin">
      # this server only allows scripts to be run, nothing else
      PerlAccessHandler Apache::Constants::FORBIDDEN
    </Location>

  if you need to get at $r->filename:
  
  Alias !~ /server-status|/server-info /usr/local/apache/perl-bin
  <Location !~ /server-status|/server-info>
    # if they don't want information, they get a script
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options +ExecCGI
    Order Allow,Deny
    Allow from All
  </Location>

NOTES

The Alias directive needs to match the regex from the container
directives exactly, otherwise it definitely will not work properly.
It might not work properly anyway...

Verbose debugging is enabled by setting 
$Apache::ReverseLocation::DEBUG=1 in your startup.pl.

The implementation of this module is very incomplete, and as such is
very alpha software.  It has not been tested on multiple platforms
environments for security, stability or other concerns.  It is 
definitely not production quality at this time.

FEATURES/BUGS

Probably many - it's alphaware.

SEE ALSO

perl(1), mod_perl(1), Apache(3)

AUTHOR

Geoffrey Young <ge...@cpan.org>

COPYRIGHT

Copyright 2001 Geoffrey Young - all rights reserved.

This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.