Forum Discussion

MK_01_145792's avatar
MK_01_145792
Icon for Nimbostratus rankNimbostratus
Mar 28, 2014

Loadbalancing by URI with universal persistency using a different part of the URI

Hi,

I have 2 goals for my irule and would much appreciate some help!

The first goal is to direct all traffic that has /homer in the HTTP request to a specific pool. I have this working with no issues. The second goal is to take the custID value in that request and persist on that value so that the same server is ALWAYS hit for that particular custID.

URL in question would look like:

http://simpsons.live.com/homer/custID=marge/blah

I have the following irule configured that also services some other URL's going to different pools:

 when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains “/homer" } {
    set pool pool_homer_80

} elseif {
    { [string tolower [HTTP::uri]] contains “/bart" } {
    set pool pool_bart_80

} else {
    set pool pool_springfield_80
    }
}

Would the following get anywhere near what I am trying to achieve. My logic is to create a session ID from the custID which will always be the same. I want to then ensure that this session ID always hits the same server:

   when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains “/homer" } {
    set pool pool_homer_80
    set  sessionId [findstr [HTTP::path] /custID 11 /]
    persist uie $sessionId
    set persistValue [persist lookup uie $sessionId]

} elseif {
    { [string tolower [HTTP::uri]] contains “/bart" } {
    set pool pool_bart_80

} else {
    set pool pool_springfield_80
    }
}

1 Reply

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    That will work. The only thing I would add is a time value to keep the persist maybe.

     

    Are you using the variable "persistValue" some place else?