TFalk_342445
Apr 12, 2019Nimbostratus
Check session variable fails
My apologies, I'm sure this is something stupidly simple that I'm just missing but I've been banging my head on this for a little while and all tests fail so far.
I want to check if a variable has been set already and if so, do nothing (in this part). And if it has not been set already, I am checking the incoming URL and picking up a specific part of the URL and set it to the variable.
I end up getting the variable set all the time, even when it's already set. I use this variable further down in the irule to redirect traffic according to this variable.
My code seems simple enough:
when HTTP_REQUEST {
if {[ info exists "ACCESS::session.custom.myvariable"] } {
log local0. "Detecting myvariable variable, not doing anything."
} else {
set uri [string tolower [HTTP::uri]]
set clientcode [string range [URI::path "$uri/" 2 2] 1 end-1]
ACCESS::session data set session.custom.myvariable $clientcode
log local0. "NOT detecting myvariable variable"
log local0. "setting session variable to be $clientcode"
}
}
And what I end up getting in the log:
`: NOT detecting myvariable variable
: setting session variable to be clienttest
: NOT detecting myvariable variable
: setting session variable to be images