[cgiapp] CGI::Application::Dispatch help

fREW Schmidt frioux at gmail.com
Wed Jan 14 10:49:33 EST 2009


> That right there is kind of a red-flag. Not that you're doing anything wrong, but Apache has a weird notion of PATH_INFO when a real directory exists. And Dispatch relies on PATH_INFO for parsing. You can check what Apache thinks it is by printing the $ENV{PATH_INFO} in your Dispatch.pm.

Ok, you're definitely right about that.  Apache just completely drops
that first bit, which was expected

>
> Why are you using a Directory for this? I'm not sure if that affects what Apache does with PATH_INFO or not, but I usually use a Location. Especially since your not serving things out of that directory directly (instead you're using ACD::Dispatch to provide a "virtual" directory).

Because I didn't know how to do it another way? :-)  I updated it to this:

<Location  /abc>
   SetHandler perl-script
   PerlHandler ACD::Dispatch
    AllowOverride None
    Order allow,deny
    Allow from all
</Location>

Note: The following has been there all along:
    ScriptAlias /abc "/path/to/abc"

>> Go to:
>> localhost/abc/
>> Get:
>> Home, welcome
>
> What is PATH_INFO here? I would expect it to be ''

You are correct.

>> Go to:
>> localhost/abc/fdjksalfdsafdsa
>> Get:
>> Home, welcome
> What is PATH_INFO here? It looks like it should be 'fdjksalfdsafdsa', but Dispatch looks like it's behaving with a PATH_INFO of ''.

You are correct.

>> Go to:
>> localhost/abc/jkfldjskljfdkls/home_othercontroller
>> Get:
>> Error'd
> Again, PATH_INFO looks like it should be 'jkfldjskljfdkls/home_othercontroller' but Dispatch behaves like it's "home_othercontroller"

You are correct.

>> Go to:
>> localhost/abc/jkfldjskljfdkls/home_othercontroller/some_rm
>> Get:
>> Home/OtherController, some_rm
> Similar to the above.

You are correct.

>> So I guess my questions are: why is it ignoring that first directory?
> I think you've hit on a weirdism of Apache changing the PATH_INFO if the real directory (in this case "abc") exists. Try changing the directory name to something else and see if that changes anything.

Ok, abc has actually always been an alias for a longer name and never
really did exist.  Or is an alias the same?

>> And
>> do I actually have to put the startrunmode in the dispatcher?  It seems to
>> be ignoring the one set in OtherController.pm.
> No, the start run mode should be executed if no run mode is given in the PATH_INFO. Try turning on debugging and see if you can get any more information.

I figured this one out.  The problem was that I had the rule
':app/:rm' => {} and it should have been ':app/:rm?' => {}.

Thanks for all of your help, I really appreciate it.

-fREW


More information about the cgiapp mailing list