Forum Discussion
IheartF5_45022
Nacreous
You'll need to create a pool, pl_redirect_pool with an HTTP monitor and Server1 and Server2 as members. Then try this rule (note you need to hardcode the IPs of Servers 1 and Server 2 in here also);-
when RULE_INIT {
set ::whichone 0
set ::servers [list "x.x.x.x" "y.y.y.y"]
Unfortunately have to hardcode the server IPs here
set ::redirs [list "http://Server1/xyz" "http://Server2/xyz"]
}
when HTTP_REQUEST {
if { [LB::status pool pl_redirect_pool member [lindex $servers $::whichone] 80] eq "up" } {}
HTTP::redirect [lindex $::redirs $::whichone]
else {
HTTP::redirect [lindex $::redirs [expr ! $::whichone]]
}
set ::whichone [expr ! $::whichone] }
}
arch_184454
Oct 13, 2015Nimbostratus
Hi IheartF5 --> I am getting an error while saving the rule, seems like it doesn't want to take the arguments:
01070151:3: Rule [/Common/App_redirection2] error: /Common/App_redirection2:12: error: [wrong args][HTTP::redirect [lindex $::redirs $::whichone]
else {
HTTP::redirect [lindex $::redirs [expr ! $::whichone]]
}]
/Common/App_redirection2:18: error: [command is not valid in the current scope][}]