Forum Discussion
Antonino
Nimbostratus
Aug 21, 2019Clock based irule
Hello guys, I have the follow irules: when HTTP_REQUEST { set url [HTTP::uri] set metodo [HTTP::method] if {([HTTP::method] eq "PUT") and ([HTTP::host] contain...
youssef1
Cumulonimbus
Sep 17, 2019Hi Antonino,
You have also Stanislas Irule that I find very well:
https://devcentral.f5.com/s/feed/0D51T00006j3fU3SAI
when RULE_INIT {
array set static::timerange {
Sunday {"05:30" "16:00"}
Monday {"05:30" "16:00"}
Tuesday {"05:30" "16:00"}
Wednesday {"05:30" "16:00"}
Thursday {"05:30" "16:00"}
Friday {}
Saturday {}
}
}
when HTTP_REQUEST {
if { ([string tolower [HTTP::uri]] contains "/contractor/") } {
if {!([class match [IP::remote_addr] equals clntip])} {
set denied 1
} else {
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
}regards
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
