Forum Discussion
APM Session Variables fail to update in cache
Here is a workaround I have used in the past.
Add this iRule to the Virtual Server...
when ACCESS_POLICY_AGENT_EVENT {
if { [ACCESS::policy agent_id] eq "my_dns_lookup" } {
if { [ACCESS::session data get session.my_loop_counter] eq "1" } {
set hostname [ACCESS::session data get session.logon.last.MyHostDestination]
ACCESS::session data set session.HostIP_1 [RESOLV::lookup @10.10.10.10 -a $hostname]
set found [ACCESS::session data get session.HostIP_1]
log local0. "Host: $hostname ...and what we found:$found ."
} elseif { [ACCESS::session data get session.my_loop_counter] eq "2" } {
set hostname [ACCESS::session data get session.logon.last.MyHostDestination]
ACCESS::session data set session.HostIP_2 [RESOLV::lookup @10.10.10.10 -a $hostname]
set found [ACCESS::session data get session.HostIP_2]
log local0. "Host: $hostname ...and what we found:$found ."
} elseif { [ACCESS::session data get session.my_loop_counter] eq "3" } {
set hostname [ACCESS::session data get session.logon.last.MyHostDestination]
ACCESS::session data set session.HostIP_3 [RESOLV::lookup @10.10.10.10 -a $hostname]
set found [ACCESS::session data get session.HostIP_3]
log local0. "Host: $hostname ...and what we found:$found ."
}
}
}
In the VPE...
-
Create a new Variable Assign Object at the beginning of the policy (before the macro)
Name: my_loop_counter initial Assignment: session.my_loop_counter = Text 0 -
Create a new Variable Assign Object after the form where they enter the hostname.
Name: my_loop_counter_assign Assignment: session.my_loop_counter = expr { [mcget {session.my_loop_counter}] + 1 } -
Create a new Variable Assign Object after the iRule Event Object (you will need to use the ID "my_dns_lookup" for the iRule Event Agent).
Name: Variable Assign Assignment: session.HostIP = if { [mcget {session.my_loop_counter}] eq "1" } { expr { [mcget {session.HostIP_1}] } } elseif { [mcget {session.my_loop_counter}] eq "2" } { expr { [mcget {session.HostIP_2}] } } elseif { [mcget {session.my_loop_counter}] eq "3" } { expr { [mcget {session.HostIP_3}] } }
You will then need to do your session.HostIP check later in the VPE.
I hope this helps you get this configured.
-Seth
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
