Forum Discussion

Ryan_Kiste_7775's avatar
Ryan_Kiste_7775
Icon for Nimbostratus rankNimbostratus
Jun 01, 2009

Dynamic Pool redirection

I am attempting to create a dynamic irule that redirects based on the users HTTP::host. Below is a static implementation of my requirements.

 

when HTTP_REQUEST {

 

switch [HTTP::host] {

 

"web1.provider.net" {pool web1.provider.net}"web2.provider.net" {pool web2.provider.net}"web3.provider.net" {pool web3.provider.net}

 

default {HTTP::redirect Fallback Host }

 

}

 

}

 

When I create this rule below, the monitor downs the virtual because the http::host is not defined in the monitor or rule.

 

} when HTTP_REQUEST {

 

set poolselect [HTTP::host]

 

set poolredirect [HTTP::host]

 

switch [HTTP::host] {

 

$poolselect {pool $poolredirect}

 

default {HTTP::redirect "fallback host" }

 

}

 

}

 

I have created a global pool to monitor all nodes in my sub-pool shown below.

 

weball-pool

 

node 1

 

node 2

 

node 3

 

node 4

 

node 5

 

node 6

 

web1.provider.net-pool

 

node 1

 

node 2

 

web2.provider.net-pool

 

node 3

 

node 4

 

web3.provider.net-pool

 

node 5

 

node 6

 

The weball-pool is my default pool under my virtual resources. With weball-pool in place the dynamic rule is not working and the user gets sent to a node in the default pool.

 

I need a way to create an irule to be dynamic to minimize the updates required to the script as more pools are added to the virtual instance. Is there a command that I can use for the monitor, while maintaining the dynamic script and still utilizing the fallback host in the http profile?
  • That exact script appears to work. If I create a global pool and add nodes and more sub-pools are added then the monitor should stay up most all the time and the user redirects if a sub-pool is down. I tried to tangle my brain around to complex of a solution.