I am using CA::Dispatch & CAP::Authentication in pretty much their out-the-box
state.
I have found that I get this to work only if I hack a line in
CAP::Authentication, but I'd like to know why things don't work without the
hack and what I should do to avoid it.
For apache I have
DocumentRoot /srv/trial/www/
PerlOptions +Parent
PerlSwitches -I/srv/trial/mod
PerlSwitches -I/srv/trial/lib
<Location /trial>
SetHandler perl-script
PerlHandler CGI::Application::Dispatch
</Location>
so that the user hits /trial/mod3/page2 and this is dispatched to Mod3.pm in
runmode page2.
(This all works perfectly.)
In Mod3.pm I have
__PACKAGE__->authen->protected_runmodes('page2');
so that upon the above hit, the user is given the built-in login form.
(This all works perfectly.)
But this is where it goes wrong. When the user hits <Sign In> the post goes to
/trial, which doesn't exist (in this example app). Looking at the page of the
form reveals it has action="/trial".
That comes from CAP::Authentication, "my $action = $query->url( -absolute => 1
);", which gives in my case '/trial'. Now, it turns out $destination is set
correctly, so if I follow this with "$action = $destination" then it all
appears to work perfectly. I'm guessing this is a case of user error, but I
can't see what I've done wrong to make $query->url give a less-than-useful
value.
While we're discussing this I could do with some advice. In this scheme it's
natural for the user to go to /trial/mod3 but if they do that then relative
links to 'page2' will go to /trial/page2 which doesn't exist. I need to force
such hits to go instead to /trial/mod3/ or at least treat them as if that's
what they hit. I should only do that if it's the mod that's missing the '/';
doing it to get /trial/mod3/page1/ would be just as broken. The question is
where is best to do that: in a subclass of Dispatch or in a prerun method of my
CA subclass?
thanks,
Nic
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################