Ladies and Gents,

I have a lite app that I am storing session data in.  I have (I think)
followed the directions found in the various tutorials for setting/getting
cookie values.  I would like to ensure that the cookies are always sent
over https/SSL...but I seem to be missing something.

I have set the sessions just like in the example like so:


#=+ set up session(cookies) defaults
my $sessions = Mojolicious::Sessions->new;
$sessions->secure(1);

and then in one of my routes, I use the session data...which all seems to
work well except for that in my developer console, I don't see the cookies
as having the 'secure' flag set:

post 'dblogin' => sub {
  my $self = shift;
  my $qparams = $self->req->body_params->to_hash;

  if(doLogin($qparams->{'host'},$qparams->{'user'},$qparams->{'pass'}) ==
1) {
    $self->session('host' => $qparams->{'host'}, 'user' =>
$qparams->{'user'}, 'pass' => $qparams->{'pass'});
    my $tx1 = 
$ua->get('https://'.$self->session('host').'/urika-admin/internal/api/db/current',
{ 'Accept' => 'application/json' });
    my $tx2 = 
$ua->get('https://'.$self->session('host').'/urika-admin/internal/api/db',
{ 'Accept' => 'application/json' });

    if ($tx1->success && $tx2->success) {
      $self->session('db' => $tx1->res->json->{'name'});
      my $databases = $tx2->res->json;
      $self->render(json => {'status' => $tx1->res->json, 'databases' =>
$databases });
    }
    else {
      if ($tx1->res->code == 401 || $tx1-res->code == 403) {
        $self->rendered($tx1->res->code);
      }
      else {
        $self->rendered(500);
      }
    }
  }
  else {
    $self->rendered(403);
  }
};

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to