Forum Discussion

BMARTIN_12200's avatar
BMARTIN_12200
Icon for Nimbostratus rankNimbostratus
Dec 15, 2008

Add Ip member pool in my header browser

Hello, my application is spread over 24 servers JBOSS cluster of 6 pools of 4 members. To facilitate maintenance I would like to appear in the title of the browser the IP address of the member on which it is connected.

 

I read a lot on the forum but I need a concrete example based on my Irule below. Thank you

 

Can you help me ?

 

=================================================

 

when HTTP_REQUEST timing on {

 

set electedpool [HTTP::cookie "persist"]

 

if {"" ne $electedpool} {

 

if { [active_members HOM_JBOSS_VIP1_POOL_$electedpool] >= 1 } {

 

pool HOM_JBOSS_VIP1_POOL_$electedpool

 

} else {

 

set P [expr ($electedpool+1) %2]

 

set electedpool ""

 

pool HOM_JBOSS_VIP1_POOL_$P

 

}

 

} else {

 

set P [expr (int(rand()*1000000))%2]

 

if { [active_members HOM_JBOSS_VIP1_POOL_$P] >= 1 } {

 

pool HOM_JBOSS_VIP1_POOL_$P

 

} else {

 

set P [expr ($P+1) %2]

 

pool HOM_JBOSS_VIP1_POOL_$P

 

}

 

}

 

}

 

when HTTP_RESPONSE timing on {

 

if {"" eq $electedpool} {

 

HTTP::cookie remove persist

 

HTTP::cookie insert name persist value "$P" path /

 

}

 

}