dariusj has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,
I'm trying to upgrade from Apache 1.3 to 2.0, and I'm receiving some major setbacks from the httpd.conf!

In Apache 1.3 I had this code:
<Location /Home> SetHandler perl-script PerlHandler XTracker::Authenticate XTracker::Home </Location>
I've changed it to this after upgrading to 2.0:
<Location /Home> SetHandler perl-script PerlResponseHandler XTracker::Authenticate PerlResponseHandler XTracker::Home </Location>
What's meant to happen is Authenticate is meant to return OK and then Home is meant to be run when /Home is accessed, however after Authenticate the execution stops!

Anyone know why?

Thanks!

Replies are listed 'Best First'.
Re: httpd.conf configuration with mod_perl
by perrin (Chancellor) on Oct 25, 2007 at 16:34 UTC
    There is documentation about this here. My advice is to make your authentication handler run in the authentication phase, rather than trying to jam it into the response phase.
Re: httpd.conf configuration with mod_perl
by mwah (Hermit) on Oct 25, 2007 at 17:51 UTC

    In addition to perrins advice, here (mod_perl docs) are some other examples that document when to invoke a handler, how and why (in Apache2/mod_perl).

    Regards

    mwa

      Works now! Set the first PerlResponseHandler to PerlAccessHandler...

      Cheers!
        Having further complications with this issue - it doesn't seem to be working fully.
        Take this example:
        <Location ~ /StockControl/Inventory$> SetHandler perl-script PerlAccessHandler XTracker::Authenticate PerlResponseHandler XTracker::Stock::Inventory::SearchForm </Location>
        Authenticate is meant to redirect to /Home with the following code:
        $r->headers_out->set( Location => "/Home" ); return REDIRECT;
        This doesn't seem to be working at all - the redirect is being completely ignored, an error message is passed to the browser but then the browser displays the rest of the page as if an OK had been passed.
        Does anyone know how this can be changed to work in mod_perl 2?
        The docs mentioned in the previous post mention that PerlAccessHandler should return FORBIDDEN or OK, does this mean REDIRECT cannot be returned at all? Also, the page does not mention REDIRECT anywhere - has this been deprecated? How should it be replaced?
        Thanks!