Forum Discussion
Jason_130176
Oct 14, 2014Nimbostratus
URL persitance iRule using UIE
I am tring to write an iRule to hash the hostname with CRC and persist all connetions for a specific URL hostname to one server, I am unable to add the uie add command in the HTTP_REQUEST context.
Is there another way to do this?
when HTTP_REQUEST {
set FQDN hash persistance
set host [string tolower [HTTP::host]]
set hash [crc32 "$host"]
set mod [expr $hash % 6]
log local0. "Matching $mod in datagroup"
if {[persist lookup uie $mod] equals ""} {
persist uie [$mod]
} else {
log local0. "UIE already exists for $mod"
}
log local0. "Matching [IP::client_addr] on $mod"
}
- What_Lies_Bene1Cirrostratus
You don't need the square brackets here;
persist uie [$mod]
You could also save a bit of memory like so (I think);
set mod [expr [crc32 [string tolower [HTTP::host]]] % 6]
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