amolari
Jan 29, 2015Cirrus
apm irule, unexpected result - variable scope not standard?
I have the following iRule
when RULE_INIT {
set entrypoint "/Reports/Pages/ReportViewer.aspx?%2fWelcome&rs:Command=Render"
set backend_host "aa.bbb.com"
}
when ACCESS_POLICY_COMPLETED {
if { [ACCESS::policy result] eq "allow" }{
set initialpath [ACCESS::session data get session.server.landinguri]
log local0. "POLICY_COMPLETED - host=[ACCESS::session data get session.server.network.name] - path=$initialpath"
if { not ($initialpath equals $entrypoint) }{
ACCESS::session data set session.custom.entrypoint.redirect "1"
log local0. "setting session.custom.entrypoint.redirect var to 1"
}
}
log local0. "Acces_policy_compl, entrypoint value= $entrypoint"
}
when ACCESS_ACL_ALLOWED {
if { [ACCESS::session data get session.custom.entrypoint.redirect] eq "1" }{
HTTP::uri $entrypoint
log local0. "Reporting : rewrite initial URI to $entrypoint done"
ACCESS::session data set session.custom.entrypoint.redirect "0"
}
set vs_host [HTTP::host]
HTTP::header replace Host $backend_host
}
in the logs I see
tmm1[8580]: Rule /Common/reporting_apm : POLICY_COMPLETED - host= - path=/
tmm1[8580]: Rule /Common/reporting_apm : setting session.custom.entrypoint.redirect var to 1
tmm1[8580]: Rule /Common/reporting_apm : Acces_policy_compl, entrypoint value= /Common/
tmm[8580]: 01220001:3: TCL error: /Common/reporting_apm - can't read "entrypoint": no such variable while executing "HTTP::uri $entrypoint"
tmm[8580]: 01220001:3: TCL error: /Common/reporting_apm - can't read "entrypoint": no such variable while executing "HTTP::uri $entrypoint"
-
variables are not passed from ACCESS_POLICY_COMPLETED to ACCESS_ACL_ALLOWED.. As a "workaround" I've set APM variables. Any reason why?
-
why the entrypoint variable cannot be read in th ACCESS_ACL_ALLOWED event and has a "corrupted" value in the ACCESS_POLICY_COMPLETED ?
Would be thankful for any tip
Alex