MK_01_145792
Mar 28, 2014Nimbostratus
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
}
}