when RULE_INIT {
set retries 0
}
when CLIENT_ACCEPTED {
set retries 0
set userip [IP::client_addr]
log local0. "the user ip is $userip"
if { [IP::addr [IP::remote_addr] equals "10.10.10.224"] } {
log local0. "==================================================="
log local0. "step no 1"
}
}
when HTTP_REQUEST {
set request [HTTP::request]
set url [HTTP::uri]
set hmethod [HTTP::method]
set retries 0
log local0. "HTTP request: $request"
if { [IP::addr [IP::remote_addr] equals "10.10.10.224"] } {
log local0. "===================Request Start ================================"
log local0. "$request"
log local0. "step no 2 new"
log local0. "HTTP request: $request"
}
}
when LB_SELECTED {
persist none
if { [IP::addr [IP::client_addr] equals "10.10.10.224"] } {
log local0. "step no 3 new"
log local0.alert "start server ip is $[LB::server] and the clientis $userip"
}
if { $retries >= 1 } {
log local0. "befor is [LB::server addr]"
LB::reselect pool pol_http_test
log local0. "after is [LB::server addr]"
if { [IP::addr [IP::remote_addr] equals "10.10.10.224"] } {
log local0.alert "end server ip is [LB::server] and the clientis $userip"
}
}
persist cookie
}
when LB_FAILED {
HTTP::redirect "someurl"
}
when HTTP_RESPONSE {
if { [IP::addr [IP::client_addr] equals "10.10.10.224"] } {
log local0. "step no 4 new"
log local0. "staus code is [HTTP::status]"
log local0. "**********Request Response************************"
}
if {([HTTP::status] starts_with "5") or([HTTP::status] starts_with "4")}{
log local0. "$url"
incr retries
log local0. "no of retries now is $retries"
log "4xx error caught: retry $retries out of [active_members [LB::server pool]]"
log "the uri is $request"
check to see if the no of you have tried all the servers in the pool
if { $retries < [active_members [LB::server pool]]} {
log local0. $hmethod
if { [IP::addr [IP::client_addr] equals "10.10.10.224"] } {
log local0. "step no 5 optional"
log local0. "staus code is [HTTP::status]"
log local0. "$request"
log local0. "*UUUUUUUUUUUUUUU Retrying Request UUUUUUUUUUUUUUUUUUUUUUUUUU"
}
HTTP::retry $request
all server are down then go and serve the page of error
} elseif {not ($url starts_with "/chat")} {
HTTP::redirect "someurls"
log local0. "$url"
log local0. "$url"
log local0. "the page couldnt be found on any of the servers $request"
}
}
}
not working as it still selecting the same node over and over agian
and once it reached to the max no of retires = no of nodes in pool it stop and direct the user to the error page
why i have used the persist none so it should work