Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

PerlAuthenHandler and ErrorDocument 401

fof

2008-05-19

Replies: Find Java Web Hosting

Author LoginPost Reply

Hello.

I am having a configuration issue trying to use ErrorDocument directive with
a PerlAuthenHandler.

I don't think that this is related to bad mod_perl behavior more likely some
silly configuration error on my part :$ Anyway I am using the centos yum
package install for apache and mod_perl 2.0

I have a PerlAuthenHandler that I use in a virtual host config using the
<Location> directive. There is also a PerlTransHandler in place for the
virtual host, however I don't think the issue is related to that because the
same issue happens when I remove the TransHandler.

The config looks like this...

<VirtualHost 192.168.0.61:80>

 ServerName rest.mydomain.com
 ServerAdmin fof@(protected)

 <Perl>
 use lib '/etc/ApacheConfig/trunk/perl5/';
 </Perl>

 DocumentRoot /vhosts/rest.mydomain.com/htdocs/
 ScriptAlias /cgi-bin/ /vhosts/rest.mydomain.com/cgi-bin/
 CustomLog /vhosts/rest.mydomain.com/logs/rest-accesslog combined
 ErrorLog /vhosts/rest.mydomain.com/logs/rest-errorlog

 PerlTransHandler +MyTransHandler

 <Location />
   PerlAuthenHandler MyAuthenHandler
   AuthType Basic
   AuthName "REST Interface"
   Require valid-user
 </Location>

    ErrorDocument 401 /http/401.html

 php_value display_errors No
 php_value log_errors Yes
 php_value trace_errors Yes

</VirtualHost>

Now when I configure the Location directive to be / then the
PerlAuthenHandler seems to work fine however this conflicts with where I am
storing the custom 401.html page (i.e. it is under the same auth zone).

I therefore get the standard page for apache 401 errors with the following
added message.. "Additionally, a 401 Authorization Required error was
encountered while trying to use an ErrorDocument to handle the request."

Now I can understand this because the auth page has auth on it etc.

The actual directory I wish to protect is
/vhosts/rest.mydomain.com/htdocs/REST/ and so I put <Location /REST/> in the
config so that only this directory from my document root
(/vhosts/rest.mydomain.com/htdocs/) should have authentication right? well
no. I can't get the PerlAuthenHandler to work unless I specify <Location />
in the config instead of <Location /REST/>.

Am I using <Location> for the wrong reason in this case? Surely I am ..

anyway helpz plz..

ta
Geoff




--
Sent from the mod_perl - General mailing list archive at Nabble.com.

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.