Forum Discussion
ShaneCal_162988
Altocumulus
Dec 02, 2014Maintenance Page iRule with allowed IP addresses
 I'm looking for a maintenance page iRule that will redirect traffic during a time frame, this iRule needs to allow certain IPs to connect to the server without being redirected to the maintenance pag...
Walter_Kacynski
Cirrostratus
Dec 02, 2014We use a DataGroup for this purpose:
when RULE_INIT {
    set static::start_date "2014-11-09 19:00"
    set static::end_date "2014-11-09 20:00"
    set static::start [clock scan $static::start_date]
    set static::end [clock scan $static::end_date]
}
when HTTP_REQUEST {
       set now [clock seconds]
       if {$now > $static::start and $now < $static::end} {
       if { not ([class match [IP::client_addr] equals VPN-IPs-DataGroup]) } { 
           if { not ([HTTP::uri] starts_with "/env") } { 
                if { [HTTP::uri] eq "/" } { 
                    HTTP::respond 200 content [ifile get Maintenance_Full_HTML] 
                } elseif { [HTTP::uri] eq "/Logo.png" } { 
                    HTTP::respond 200 content [ifile get Logo_png] 
                } elseif { [HTTP::uri] eq "/genericToolbox.png" } { 
                    HTTP::respond 200 content [ifile get genericToolbox_png]
                } else { discard }
           }
        }
    }
}
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