Forum Discussion
Ronak_79648
Feb 09, 2012Nimbostratus
no such variable and variable scope
running v 11.1
i have rule.
when ACCESS_POLICY_AGENT_EVENT {
log local0. "Access policy event triggered."
if {[ACCESS::policy agent_id] == "LogonSuccess"} {
log local0. "Access policy LogonSuccess"
set redir 1
}
}
when HTTP_REQUEST {
log local0. "HTTP Request detected. [HTTP::uri]"
if {$redir == 1} {
log local0. "Redir was 1, redirecting"
HTTP::redirect https://abc.com/xyz
}
}
looking for suggestion on how to make this work. i want to redirect to something based on access policy event.
i have apm policy assigned to domain test and once autheticated want to go to https://abc.com/xyz
trying to implement portal with SSO
Feb 9 15:07:14 tmm1 info tmm1[8947]: Rule /Common/iRule_abc : Access policy event triggered.
Feb 9 15:07:14 tmm1 info tmm1[8947]: Rule /Common/iRule_abcd : Access policy LogonSuccess
Feb 9 15:07:14 tmm2 info tmm2[8948]: Rule /Common/iRule_abc
: HTTP Request detected. /
Feb 9 15:07:14 tmm2 err tmm2[8948]: 01220001:3: TCL error: /Common/iRule_RedirectToPulseSSO - can't read "redir": no such variable while executing "if {$redir == 1} { log local0. "Redir was 1, redirecting" HTTP::redirect https://abc.com/clarian/layoutTemplates/html/access/ssoLog..."
- naladar_65658AltostratusI could be wrong, but it seems like the events as you have them are out of order. You are using a local variable so once you set it, you should be able to call it using that same VIP/connection, but if HTTP_REQUEST is happening before the other event processes then I think you would see what you are seeing there. It can't read the variable because nothing is there. The iRule logging is taking place in the order which you have it in the iRule, but the execution doesn't seem to be following that particular order.
- Ronak_79648Nimbostratuswe found better way to do same. here is how iRule look like
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects