Forum Discussion

nortendo_279044's avatar
nortendo_279044
Icon for Nimbostratus rankNimbostratus
May 31, 2018

irule redirect specific uri maintenance mode timestamp

Hi everybody,

 

i want to create an irule to redirect to a specific uri during the maintenance mode from saturday at 8h00 am until sunday at 20h00 pm .

 

I found this example below but i need to add a redirection to a specific url during the maintenance mode ...

 

when RULE_INIT { set static::start_date "2018-06-02 20:30" set static::end_date "2011-06-02 21:00" set static::start [clock scan $static::start_date] set static::end [clock scan $static::end_date] } when CLIENT_ACCEPTED { set now [clock seconds] if {$now > $static::start and $now < $static::end}{ HTTP::respond 301 noserver Location "; Connection Close } }

 

Thank you so much for your support

 

Kind regards

 

1 Reply

  • Hi,

    you can try this (simple and functional):

    when CLIENT_ACCEPTED {
        set START_OFF_TIME [clock scan "01:00 AM"]
        set END_OFF_TIME [clock scan "05:00 AM"]
    }
    
    when HTTP_REQUEST {
    set now [clock seconds]
    
    if { ( $now > $START_OFF_TIME ) && ( $now < $END_OFF_TIME ) } {
        HTTP::redirect "http://www.xyz.com/maintenancepage/"
        TCP::close
     }
    }
    

    Reference (Stanislas Piron): https://devcentral.f5.com/questions/irule-based-on-time-50868

    Let me now if you need assistance on IT

    Regards