3

I have a member's area on my website on my default port 80, there is a user app running on port 8080 of my website called UserPort, when a user goes to UserPort a new empty(has no username inside) session is created. Is there anyway for me to keep the same session from port 80 onto port 8080?

EDIT: Ok so I was referred to the following answer for my problem=Same Session ID on Same IP Address but Different Ports but the code isn't explained well, do I put the first segment of the code with port 110 into my member's area page and put the second segment into my UserPort page?

Community
  • 1
  • 1
geotsak
  • 107
  • 1
  • 10

1 Answers1

-1

Because there are two different servers, you cannot easily (as in out-of-the-box) share the session. However, you could make a request from your apache app to your tornado app to "prepare" a session for the user. Then, when the user is redirected to the UserPort, she should get something to identify herself. Because of this: Are HTTP cookies port specific? it's not reliable to use cookies, so a one-off token in the URL would probably do.

To put it into a very simplified pseude code:

// apache 
$token = createRandomString();
call($tornadoAppUrl, $userData, $token);
$link = createUserPortLink($tornadoAppUrl, $token);
echo "<a href='$link'>go to UserPort</a>"

//tornado UserPort
$token = 
$userData = getUserSession($token);
... act accordingly

Hope it's clear.

Community
  • 1
  • 1
ptrk
  • 1,800
  • 1
  • 15
  • 24