Perl CGI::Session - Migrating user sessions to new server, without them knowing it -


i need move our perl apps new server, don't want have re-authenticate when move made. i'd have our "home" script redirect on new server, pre-plant cookie, corresponding session file in /tmp, each user before make dns change.

thought simple it's turning out not be. or i'm missing right in front of face.

here code put in "home" script on current server..

my $has_session = $cgi->param("session") || ""; if ($has_session eq "") {     $url = "http://111.222.333.444/cgi-bin/setnewsession.cgi?back=http://" . "$env{server_name}" ."$env{script_name}";     print "location: $url\n\n"; } 

and here code in script on new server...

use strict; use warnings; use cgi; use cgi::session; use cgi::carp qw/fatalstobrowser warningstobrowser/;  $cgi = new cgi;  $userid = $cgi->param("userid"); $redir_back = $cgi->param("back"); $session = cgi::session->load() or die $!; $session_userid = $session->param("userid");  if (! defined $session_userid) {      $session->expire("9y");     $session->param("userid",$userid);     $session->flush(); }  $url = $redir_back . "?session=1"; print $session->header(-location=>$url); exit; 

no cookie. no session file. nothing.

p.s. please, no flak 9y expiration. management "above" having login. :)

here code put in "home" script on current server..

that part doesn't seem transmit userid, doesn't use url(qw/ -full 1 -rewrite 1 /) retrieve url value back=

you might want crypt::cbc userid (and back) using rjindel session::storage::secure cookies (utsl)

and here code in script on new server... no cookie. no session file. nothing.

the way read program, should have @ least throw error because load won't create session, called load() not called new. new create session.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -