Forum Discussion

Jason_130176's avatar
Icon for Nimbostratus rankNimbostratus
Oct 14, 2014

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?

 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"

1 Reply

  • 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]