[Catalyst] trouble with LocationMatch

mock mock at obscurity.org
Fri Dec 9 07:53:23 CET 2005


On Thu, Dec 08, 2005 at 09:04:37PM -0500, Andy Grundman wrote:
> Sean Comeau wrote:
> >    <LocationMatch "/(cart|orders|checkout)/{0,1}(\w+/{0,1})*$">
> >        SetHandler perl-script
> >        PerlResponseHandler  CoreStore
> >    </LocationMatch>
> 
> OK, the problem here is that we rely on the value of $r->location to 
> determine where your app is running.  In this case, $r->location returns 
> the complete regex which is not helpful.
> 
> So you'll need to rework your setup to use Location blocks, perhaps just 
> using 3 locations
> 
> <Location /cart>
> <Location /orders>
> <Location /checkout>
> 
> all served by CoreStore would work?  Then handle your other regex 
> restrictions within your app.
> 
> If you have any other suggestions I'm all ears. :)
> 
> -Andy
> 

Some initial hacking shows that forcing $base_path to be '' solves the
problem.  I'm not exactly sure what it is being used for though.  What is
$c->request->base used for?  How is that different than $c->request->uri?

The following hack solves the problem:

    my $location = $self->apache->location;
    if ( $location && $location ne '/' ) {
        $base_path = $location;
    }
    $base_path = '';

It looks like that conditional should be modified to figure out if we're in a
locationmatch vs a location, but I'm not sure the reasoning behind it for
location...

mock





More information about the Catalyst mailing list