Forum Discussion
Ramesh_Polarapu
Nimbostratus
May 10, 2008Load Balancer to forward the traffic when the Pool is down
In our setup we have a Virtual server MM1-Traffic and it has an iRule associated with it namely "Vantrix-v7.0". The purpose of this iRule is to differentiate the POST/GET in the HTTP requests and redi...
hoolio
Cirrostratus
May 12, 2008Hi Ramesh,
If you set the pool in CLIENT_ACCEPTED and then set it to the GET or POST pools in HTTP_REQUEST in the second rule, the last rule's setting will override the first as the HTTP_REQUEST event is triggered after the CLIENT_ACCEPTED event. To fix this, you could either combine the rules or to set a flag in one rule which checks if the pool was specified in a previous rule. Here is an example of the first option:
when HTTP_REQUEST {
Select a pool based on the HTTP method
switch [HTTP::method] {
"GET" {
log local0. "[IP::client_addr]:[TCP::client_port]: GET request to [HTTP::host][HTTP::uri]"
Check if the selected pool has available members
if {[active_members Van-Get]}{
log local0. "[IP::client_addr]:[TCP::client_port]: using Van-Get pool"
pool Van-Get
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: using MM1-Redirect pool. Van-Get pool is down"
pool MM1-Redirect
}
}
"POST" {
log local0. "[IP::client_addr]:[TCP::client_port]: GET request to [HTTP::host][HTTP::uri]"
Check if the selected pool has available members
if {[active_members Van-Post]}{
log local0. "[IP::client_addr]:[TCP::client_port]: using Van-Post pool"
pool Van-Post
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: using MM1-Redirect pool. Van-Post pool is down"
pool MM1-Redirect
}
}
default {
Do something for non-GET/non-POST requests?
If nothing is done, the request will go to the default pool on the VIP if one is configured.
log local0. "[IP::client_addr]:[TCP::client_port]: Request method [HTTP::method] to [HTTP::host][HTTP::uri] was not GET or POST. "
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects