Forum Discussion
ADA506
Jan 27, 2021Nimbostratus
Schedule Maintence Page
Hello, Hopefully someone is able to help me.. We have a Big-IP hosted in AWS and running 15.1.0.4. We have a maintence page that needs to display when the pool members are down (which i have workin...
Jan 27, 2021
Hi,
You could use this:
when RULE_INIT {
array set static::timerange {
Sunday {}
Monday {}
Tuesday {"02:00" "14:00"}
Wednesday {}
Thursday {}
Friday {}
Saturday {}
}
}
when HTTP_REQUEST {
if { ([string tolower [HTTP::uri]] contains "/contractor/") } {
set now [clock seconds]
set current_day [clock format $now -format {%A}]
set start [lindex $static::timerange($current_day) 0]
set end [lindex $static::timerange($current_day) 1]
if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} {
set denied 0
} else {set denied 1}
unset start end
} else {set denied 0}
if { $denied } {
HTTP::respond 200 content "Not Authorised! Contact AdministratorNot Authorised! Contact Administrator..."
} else {pool POOL_443}
unset denied
}
Cheers,
Kees
- ADA506Jan 27, 2021Nimbostratus
Would i have to have this as a seperate irule than the one i have for when pool members are down? Sorry i am not the best with iRules.
- Jan 28, 2021
No, it can be the same irule.
when RULE_INIT { array set static::timerange { Sunday {} Monday {} Tuesday {"02:00" "14:00"} Wednesday {} Thursday {} Friday {} Saturday {} } } when HTTP_REQUEST { if { ([string tolower [HTTP::uri]] contains "/contractor/") } { set now [clock seconds] set current_day [clock format $now -format {%A}] set start [lindex $static::timerange($current_day) 0] set end [lindex $static::timerange($current_day) 1] if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} { set denied 0 } else {set denied 1} unset start end } else {set denied 0} if { $denied } { HTTP::respond 200 content "Not Authorised! Contact AdministratorNot Authorised! Contact Administrator..." } elseif { [active_members [LB::server pool]] == 0 } { HTTP::respond 200 content "<content>" unset denied } else {pool POOL_443} unset denied }
Cheers,
Kees
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