Forum Discussion
Shiraz
Apr 28, 2016Altostratus
Irule to block access of VS on specific days
Dears,
I am able to restrict the access to Virtual Server by providing the static time by using the below irule. However, I also want to use this irule to restrict the access on weekends.
when R...
Stanislas_Piro2
Apr 28, 2016Cumulonimbus
Hi,
current_day may not be defined in RULE_INIT but in HTTP_REQUEST.
you can filter on day number (1-7) and not day name (Monday,...) with command :
set current_day [clock format [clock seconds] -format {%u}]
The irule become:
when RULE_INIT {
set static::START_OFF_TIME [clock scan "05:30 AM"]
set static::END_OFF_TIME [clock scan "01:00 PM"]
}
when HTTP_REQUEST {
set now [clock seconds]
set current_day [clock format [clock seconds] -format {%u}]
if { ($current_day < 6 ) && ( $now > $static::START_OFF_TIME ) && ( $now < $static::END_OFF_TIME ) } {
HTTP::respond 200 content "Maintenance ModeMaintenance mode..."
}
}
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