[dancer-users] Add a cookie and redirect

Amelia Ireland aireland at lbl.gov
Sat Aug 6 00:56:33 BST 2016


> That said, using a cookie to set a redirect seems unnecessary. Can't you
just put it in the redirect URL?

No, unfortunately not -- I'm using an external authentication server and
this is the method that it uses to return the user to wherever they were
before logging in. :-\

Thanks for the tip -- the problem seems to be in testing the
existence/value of the cookie. For unknown reasons, HTTP::Cookies doesn't
seem to be parsing the cookie, even though it seems to be present in the
HTTP::Headers object.


On 4 August 2016 at 14:19, Andrew Beverley <andy at andybev.com> wrote:

> On Thu, 4 Aug 2016 13:52:15 Amelia Ireland <aireland at lbl.gov> wrote:
> > my $c = Dancer2::Core::Cookie->new(
> > name => 'return_to',
> > value => '/',
> > domain => config->{sso_domain},
> > expires => '5 mins'
> > );
> >
> > push_response_header 'Set-Cookie' => $c->to_header;
>
> You're probably best just using the cookie keyword:
>
>   cookie return_to => '/', expires => ..., domain => ...
>
> That said, using a cookie to set a redirect seems unnecessary. Can't
> you just put it in the redirect URL?
>
> Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20160805/8c6b407d/attachment.html>


More information about the dancer-users mailing list