Forum Discussion

Kamalpreet_1068's avatar
Kamalpreet_1068
Icon for Nimbostratus rankNimbostratus
Aug 29, 2012

Node health checkup

Hi ,

 

 

I have developed a IRULe which is forwarding a request between 2 nodes and also changing the host header values. Request is toggling between 2 nodes irespective of the health of nodes.

 

 

I want to add a additional condition here something like if a node is up only then it should forward a traffic.

 

because now what happening is even if my one server is down it is forwarding the request to that server and connection breaks.

 

 

 

 

when RULE_INIT {

 

set ::whichone 0

 

}

 

when HTTP_REQUEST {

 

switch $::whichone {

 

0 {

 

HTTP::header replace "Host" "xsp.pac.com:8100"

 

use node 10.206.134.23

 

}

 

1 {

 

HTTP::header replace "Host" "abc.pac.com:8100"

 

use node 10.206.134.24

 

}

 

}

 

set ::whichone [expr ! $::whichone]

 

}

 

1 Reply

  • Hi Kamalpreet,

     

     

    I think you can use round robin load balancing to a pool of the two hosts that has a monitor configured. If you need to rewrite the host header you can use an iRule like this:

     

    https://devcentral.f5.com/wiki/iRules.rewrite_host_header_to_server_name.ashx

     

     

    Using a global variable as you have will demote the virtual server from running on more than one CPU core:

     

    https://devcentral.f5.com/wiki/iRules.CMPCompatibility.ashx

     

     

    Aaron