perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: add httpd.conf directive
Date Mon, 17 Sep 2007 09:10:09 GMT


pennyyh@aol.co.uk wrote:
> I'm running mp1 with PerlAccessHandler handler.
> I want to add some config directive into httpd.conf,and let my module 
> use them for passing auth.
> ie,in httpd.conf I add these lines,
> 
> PassAuthIPs    12.34.56.78  23.45.67.89
> 
> Then the requests from these IPs would get past.

Isn't that easier to do with the following standard Apache directives 
(independently of mod_perl) ?
<location  /xyz>
   Deny from all
   Allow from (list of IP's)
</location>

If the above is not applicable, then you could use something like
<location /xyz>
   PerlSetVar AllowedIps "ip1 ip2 ip3"
   ...
</location>

and in your module do

sub handler {
   my $r = shift; # the request object
   my $AllowedIps = $r->dir_config('AllowedIps') || ''; # get "ip1 ip2 ip3"
   ...
}
and I guess there must be a function in mod_perl to get the IP from 
which the request is coming, to compare.

Hope this helps.

Mime
View raw message