djamil_chlih_23
Aug 21, 2017Nimbostratus
Irule maintenace page switches to another page after a time defined
Dear all,
I have done an Irule that switches a maintenace page to another page after a 5 min, this Irule is Work well for one Virtual Server, when i deploy it to more then one Virtual Server, the second Maintenance page don't display, because i use the global variable.
have you an idea to how can i change this iRule for working on all Virtual Server?
please find below the Irule:
when RULE_INIT {
set ::timestart [clock seconds]
}
when CLIENT_ACCEPTED {
if { [active_members [LB::server pool]] < 1 } {set lb 0}
elseif { [active_members [LB::server pool]] > 0 }{
set lb 1
set ::timestart [clock seconds]
}
}
when HTTP_REQUEST {
if {$lb ==0}{
set timenow [clock seconds]
set timeduration [expr {int($timenow) - int($::timestart)}]
switch -glob [HTTP::path] {
"*/image1.png" {
HTTP::respond 200 content [ifile get imagefile1] "Content-Type" "image/png"
}
"*/image2.png" {
HTTP::respond 200 content [ifile get imagefile2] "Content-Type" "image/png"
}
}
default {
if {$timeduration < 300}{
HTTP::respond 200 content [ifile get Sorry_Page] "Content-Type" "text/html" noserver
}
else {
HTTP::respond 200 content [ifile get Sorry_Page_5] "Content-Type" "text/html" noserver
}
}
}
TCP::close
}
}
Thank you for you help.