Forum Discussion
djamil_chlih_23
Nimbostratus
Aug 21, 2017Irule 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 ...
Stanislas_Piro2
Cumulonimbus
Aug 22, 2017Hi,
use table with virtual server name as key instead of global variables
when RULE_INIT {
set static::table_timeout 43200
}
when CLIENT_ACCEPTED {
if { [active_members [LB::server pool]] < 1 } {
set lb 0
} elseif { [active_members [LB::server pool]] > 0 } {
set lb 1
if {[table lookup -subtable maintenance [virtual name]] ne 1} {
table set -subtable maintenance [virtual name] 1 $static::table_timeout 0
}
}
}
when HTTP_REQUEST {
if {$lb ==0}{
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 {[expr {[table lifetime -subtable maintenance -remaining [virtual name]] - $static::table_timeout}] < 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
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects