Forum Discussion
Irule redirect - periodic
Hello all,
I'm looking for a way to create an Irule redirecting to 2 different uri depending of the period of the year.
Example : I want this url https://blabla from 2020/02/20 to 2020/08/20 and this url https://blablabla from 2020/08/21 to 2020/02/19.
I hope my question is clear enough.
I couldn't find anything about date and time in irules on dev/central.
Thanks for your help.
Hello Yann ,
You need to use START_OFF_TIME and END_OFF_TIME commands on your iRule.
https://devcentral.f5.com/s/question/0D51T00006j3fU3/irule-to-block-access-of-vs-on-specific-days
- Yann_RNimbostratus
Dear Lidev,
Thanks for your quick answer.
I'm not sure at all about my code, can you please review it and let me know your thought ?
when RULE_INIT {
set static::START_DATE "2020-02-21 00:00"
set static::END_DATE "2020-08-14 00:00"
}
when HTTP_REQUEST {
if { ( [clock seconds] < $static::START_DATE) || ( [clock seconds] > $static::END_DATE) } {
switch -exact [HTTP::uri] {
"/uriname" {HTTP::redirect "https://www.blabla.html"}
else
switch -exact [HTTP::uri] {
"/uriname" {HTTP::redirect "https://www.blablabla.html"}
}
}
Thanks,
- Yann_RNimbostratus
Any feedback on this one please ?
Thanks very much !
Recent Discussions
Related Content
* 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