Forum Discussion

Praveen_Bhanda1's avatar
Praveen_Bhanda1
Icon for Nimbostratus rankNimbostratus
Nov 15, 2007

session name/value sharing in virtuals of http and https

I have a name and value to be stored in session. We wrote an irule that can store these name and values in session. We retrieve this information. This irule is applied to 2 virtuals, one with 80 port(http) and other with https(443). This irules works great. If user going to http virtual, then session info is stored there. If users changed to https virtual, the same session info stored by http virtual is not available. Since we want to enable users to stay in http generally and then shift to https when needed, this sharing of session information needed.

 

 

Could some one suggest how to do this? Since I have name and value to store with timeout, I am thinking persist is not sufficient. Is there any other way to share that session info between 2 virtuals?

 

 

Thanks for your help

 

 

some more information

 

Currently we have 2 VIPs (one for 80 port and other for 443 port). Each VIP is configured to Run an irule to handle cookie management. They both has separate persistence pool to connect to back-end servers.

 

 

Our requirement fro Business is: make all the page to non-secure until user logs in or do a checkout.

 

 

In order to achieve above requirement, we did the following.

 

 

Keep 2 VIPs (one for 80 port and other for 443 port). Each VIP is configured to run an iRule to handle cookie management. Both VIPs are configured to use ONLY one persistence pool with share across.

 

 

The above solved when cookie is disabled(not running irule) we are able to get to correct leg to make everything working. But with cookie disabled, we are able to access the pages as http, but when we shift from http to https, the cookie that was first created by the http irule is not accessible by https VIP irule.

 

 

We add in the irule code as below:

 

 

session add uie $id $saveCookies $::sessionTimeout

 

 

and read as: set saveCookies [session lookup uie $id]

 

 

Is this session belongs to each VIP irule association? Does this session accessible by other VIP irule association? If not, can this be shared across VIPs?

 

 

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account

    You'll need to use the "any virtual" option to share session table data across virtual servers.

    Since you are using a variable to specify the key, some very specific syntax is required to pass the number of parameters expected and still expand the variable. Give this a try:
    session add uie [list $id any virtual] $saveCookies $::sessionTimeout
    set saveCookies [session lookup uie [list $id any virtual]]

    HTH

    /deb