Domai_23823
Dec 01, 2017Nimbostratus
Maint page irule help
Hello I am trying to come up with a iRule for maint page. The requirement is -
- The page should be displayed when all the servers in the pool are down.
- The servers will be patched and will be rebooted one at a time and will be tested. During testing I need the users from one ip range to access the site but the maint page should be displayed for all the other users.
The below is what I came up with so far...with errors ofcourse..where am I going wrong?
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
HTTP::respond 200 content [ifile get "Maintenance_html"] noserver "Cache-Control" "no-store, no-cache"
return
}
}
elseif { [active_members [LB::server pool]] > 0 } {
check if client access from internal subnet
if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] } {
pool http_80
} else {
switch [HTTP::uri] {
default { HTTP::respond 200 content [ifile get "Maintenance_html"] noserver "Cache-Control" "no-store, no-cache"
}
}
}
}
}