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...
Ibrahim_Kadiri
May 03, 2016Nimbostratus
Stan,
Thanks for the rule, but in your rule the Second condition when HTTP_REQUEST is not being executed. i have created the below rule which is working fine but i need to add one more condition (if { ( [class match [IP::remote_addr] equals clntip]). this condition when i add in the below rule it is not working, remaining the rule is working fine.
Kindly advice.
when RULE_INIT {
set static::START_OFF_TIME [clock scan "05:30 AM"]
set static::END_OFF_TIME [clock scan "04:00 PM"]
}
when HTTP_REQUEST {
set now [clock seconds]
set current_day [clock format [clock seconds] -format {%u}] }
if { not ([string tolower [HTTP::uri]] contains "/contracts/") } {
pool POOL_443
}
elseif { ([class match [IP::remote_addr] equals clntip]) && ([string tolower [HTTP::uri]] contains "/contracts/") && ($current_day >= 1 ) && ($current_day < 4 ) && ( $now > $static::START_OFF_TIME ) && ( $now < $static::END_OFF_TIME ) } {
pool POOL_443
}
elseif { ([class match [IP::remote_addr] equals clntip]) && ([string tolower [HTTP::uri]] contains "/contracts/") && ($current_day == 7 ) && ( $now > $static::START_OFF_TIME ) && ( $now < $static::END_OFF_TIME ) && ( [class match [IP::remote_addr] equals clntip]) } {
pool POOL_443
}
elseif { ([string tolower [HTTP::uri]] contains "/contracts/") && ($current_day == 5 ) or ($current_day == 6 ) } {
HTTP::respond 200 content "Weekend!Its a Weekend! Contact Administrator..."
}
else {
HTTP::respond 200 content "Not Authorised!Not Authorised! Contact Administrator..."
}
}
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