I thought it might be because the F5 doesn't have to make a load balancing decision so it didn't have a pool name. Either way I reordered the rule so that it wouldn't be an issue. I now check to see if the override cookie is there, if not I check the pool to see how many members are up. I also added some on and off switches at the top to make things easier to keep track of. It's getting too big and complicated to just go in and comment stuff out when I want to turn things off. I've pasted my entire irule below for anyone that wants it. I'll also codeshare it.
when HTTP_REQUEST {
set some variables:
sets the timer to return client to host URL
set sectime 6
if we want to redirect any uri's consisting of / to anywhere, set the following entries:
0=off, 1=on
set redirectdefaulturlon 0
and set the URI that you want to redirect to:
set redirectdefaulturl ""
Turn on redirect of http to https?
0=off, 1=on
set redirectsecureon 0
enable persistence override?
0=off, 1=on
set persistenceoverrideon 0
set the incoming port, so we know what port to use on the server side
if {[TCP::local_port] == 443} {
set incomingport 80
}
else {
set incomingport [TCP::local_port]
}
if { $persistenceoverrideon == 1 } {
check for a cookie override on persistence
if { [HTTP::cookie exists "F5NODEPERSIST"]} {
node [HTTP::cookie F5NODEPERSIST] $incomingport
log "[IP::client_addr]:[TCP::client_port]: New request to [IP::local_addr]:[TCP::local_port] for [HTTP::uri], sent to node [HTTP::cookie F5NODEPERSIST]:$incomingport"
set activememberslbpool 1
}
else {
set activememberslbpool [active_members [LB::server pool] ]
}
check if we need to set persistence override
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=/"
log "[IP::client_addr]:[TCP::client_port]: New request to [IP::local_addr]:[TCP::local_port] for [HTTP::uri]"
return
}
}
else {
set activememberslbpool [active_members [LB::server pool] ]
}
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"
}
check to see if we match any URI's, to do various things like 503 response, redirect, etc
switch [HTTP::uri] {
"/maintenance" {
if { $activememberslbpool > 0 } {
if { $redirectdefaulturlon == 1} {
HTTP::redirect http://$host$redirectdefaulturl
}
else {
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
}
"/" {
if { $redirectdefaulturlon == 1 } {
HTTP::redirect "http://$host$redirectdefaulturl"
}
return
}
default {
If the pool is down, redirect to the maintenance page
if { $activememberslbpool == 0 } {
HTTP::respond 200 content \
"
"
}
return
}
}
if { $redirectsecureon == 1 } {
if { [TCP::local_port] == 80} {
HTTP::redirect https://$host[HTTP::uri]
return
}
}
}
when HTTP_RESPONSE {
HTTP::header insert SOURCE_ADDRESS [IP::server_addr]
}