Forum Discussion
iRule to run only once - implementing persistence
Hi All,
I have a simple iRule that I want to run only once per user. The intention is to check the IP of the client and redirect based on the identified continent. Catering for false positives, users that are redirected, will have the option to move back to the original site. In this case we cannot have the iRule run a second time or they will be directed back to the previous site once more and then be stuck in a loop.
I have been looking at Hash Persistence on the LTM. I'll investigate further to see if this can perform the task I require.
Thanks in advance.
when HTTP_REQUEST {
if { ([ whereis [IP::client_addr] country] eq EU ]) } {
HTTP::redirect "https://I-See-You-Are-In-Europe"
}
For verification, tail /var/log/ltm as you implement the changes
log local0. "IP: [IP::client_addr]; Continent Code: [whereis [IP::client_addr] country]]"
}
- JGCumulonimbus
You can use
to do the HTTP redirect, and set a temporary HTTP cookie in the same operation. If the user comes back again (with the cookie), you can tell the irule not to do the redirect.HTTP::response
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