APM Session Variable Set

Hello DevCentral,

I am trying to set an APM Variable in the ACCESS_POLICY_AGENT_EVENT as follows below. From the ltm log file I can see that the jsessionid variable is not referenced but I can not understand why..Please can you help me?

Thanks in advance.

when ACCESS_POLICY_AGENT_EVENT {

switch [ACCESS::policy agent_id] {

"AUTH" {
 create connection
set serverconnection [connect -protocol TCP -timeout 100 -idle 5 -status conn_status 10.72.20.30:80] 
 create HTTP GET request
set httpget "GET /xxx2/ HTTP/1.1\r\nHost: mydomain.com\r\n\r\n"  
 send the request
send -status send_status -timeout 300 $serverconnection $httpget
set httpresponse [recv -status recv_status -timeout 1000 $serverconnection]
regexp "(JSESSIONID=.*)(edited)" $httpresponse jsessionid 
ACCESS::session data set session.custom.jsessionid $jsessionid
set cookie [format "%s=%s; secure; path=/; HttpOnly; domain=%s" "JSESSIONID" $jsessionid "mydomain.com"]
}
}
}

when ACCESS_POLICY_COMPLETED {
set cookieinjection [ACCESS::session data get session.insertcookie]
set jsessionid  [ACCESS::session data get session.custom.jsessionid]

if { $cookieinjection == 1 } { 

set cookie [format "%s=%s; secure; path=/; HttpOnly; domain=%s" "JSESSIONID" $jsessionid "mydomain.com]
ACCESS::respond 302 Location https://mydomain.com/xxx2/ "Set-Cookie" $cookie 

}

}

I can see where the jsessionid cookie is added to the APM Session table but where is the insertcookie value set?

ACCESS::session data set session.custom.jsessionid $jsessionid

Hi Robert! Thank you for your response. Oh sorry, the insertcookie value is set through the APM object in the VPE. The value is set as follows: session.insertcookie = Text 1