transfer values between sessions
Hello, I need transfer value between different client requests (sessions?). First I used cookie (e.g. cookie name "cookie-a"), but value of this cookie should be not visible on client site. I have other cookie (e.g. "cookie-b") based on it I can pair bot connections.
In first connection I need store value (before stored in cookie-a) on big-ip. In second connection I need read this value.
I can use session or table, but based on documentation it's not clear for me. https://devcentral.f5.com/articles/the101-irules-101-variables https://devcentral.f5.com/wiki/iRules.session.ashx https://devcentral.f5.com/wiki/iRules.table.ashx
what is better choose - session or table (I'm not familiar with both of them). where are more details about for session?
I have two apps (/server1.txt and /server2.txt) between this I need transfer value. In my lab I have three clients (different browsers on the same pc - FF, IE, EDGE). when I try to use 'session' (see code below) it is working but I'm not sure if this is correct code.
exists any better solution of this?
here is my code:
when HTTP_REQUEST {
switch [HTTP::uri] {
"/server1.txt" {
random value for client session (based on cookie 'cookiename')
set uid [clock seconds]
session add sticky cookiename $uid 30
if { [HTTP::cookie exists cookiename] } {
session add simple [HTTP::cookie value cookiename] $uid 30
}
}
"/server2.txt" {
read of value in another client connection (http request)
it is working but I'm not sure if it's best solution
if { [HTTP::cookie exists cookiename] } {
set value [session lookup simple [HTTP::cookie value cookiename]]
} else { set value "undefined" }
HTTP::respond 200 content "this is uid='$value'" "content-type" "text/plain" "Connection" "close"
event HTTP_REQUEST disable
}
}
martin