Forum Discussion
Scot_85536
Aug 05, 2009Nimbostratus
Interesting... that fixed it Thanks Aaron!
I thought it would automatically pick up the port from the pool member that I specify which is why I didn't specify a port, but apparently that's not the case. When I use the override I get the following errors, although the rule seems to work properly:
Aug 5 12:37:56 tmm tmm[1086]: 01220001:3: TCL error: Rule HTTP-With-Unavailable - no such pool Failed Tcl_pool_GetFromObj: pool (line 1) invoked from within "active_members [LB::server pool] " ("default" arm line 3) invoked from within "switch [HTTP::uri] { "/maintenance" { if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host} else { HTTP::respon..."
Aug 5 12:37:56 tmm tmm[1086]: 01220001:3: TCL error: Rule HTTP-With-Unavailable - no such pool Failed Tcl_pool_GetFromObj: pool (line 15) invoked from within "active_members [LB::server pool] " ("default" arm line 3) invoked from within "switch [HTTP::uri] { "/maintenance" { if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host} else { HTTP::respon..."
Aug 5 12:37:56 tmm tmm[1086]: 01220001:3: TCL error: Rule HTTP-With-Unavailable - no such pool Failed Tcl_pool_GetFromObj: pool (line 15) invoked from within "active_members [LB::server pool] " ("default" arm line 3) invoked from within "switch [HTTP::uri] { "/maintenance" { if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host} else { HTTP::respon..."
Aug 5 12:37:56 tmm tmm[1086]: 01220001:3: TCL error: Rule HTTP-With-Unavailable - no such pool Failed Tcl_pool_GetFromObj: pool (line 15) invoked from within "active_members [LB::server pool] " ("default" arm line 3) invoked from within "switch [HTTP::uri] { "/maintenance" { if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host} else { HTTP::respon..."
Here's the complete rule now:
when HTTP_REQUEST {
sets the timer to return client to host URL
set sectime 60
Use the Host header value for the responses if it's set. If not, use the VIP address.
if {[string length [HTTP::host]]}{
set host [HTTP::host]
set errhost1 [HTTP::host]
set errhost2 [HTTP::host]
} else {
set host [IP::local_addr]
set errhost1 "site"
set errhost2 "the site"
}
switch [HTTP::uri] {
"/maintenance" {
if { [active_members [LB::server pool] ] > 0 } {HTTP::redirect http://$host}
else { HTTP::respond 503 content "Maintenance page content=$sectime;url=http://$host>\
503 - Service temporarily unavailable
\
We are performing routine maintenance designed to improve your $errhost1 experience. \
We will have $errhost2 up again as soon as possible.
\
You will be automatically redirected to $errhost2 when it becomes available.
" "Content-Type" "text/html"
return
}
return
}
"/" {HTTP::redirect "http://$host[HTTP::uri]"
return
}
default {
If the pool is down, redirect to the maintenance page
if { [active_members [LB::server pool] ] == 0 } {
HTTP::respond 200 content \
"
"}
}
}
if { [HTTP::cookie exists "F5NODEPERSIST"]} {
node [HTTP::cookie F5NODEPERSIST] 80
}
if {[HTTP::uri] contains "/F5SERVERSELECT"} {
set backendip [getfield [HTTP::uri] "&" 2]
set backendip [getfield $backendip "/" 1]
HTTP::respond 200 content "Persistence cookie set until browser is closed or cookies are cleared" "Set-Cookie" "F5NODEPERSIST=$backendip; path=/"
return
}
}
when HTTP_RESPONSE {
HTTP::header insert SOURCE_ADDRESS [IP::server_addr]
}