Forum Discussion
Andre_Muniz
Jul 01, 2011Nimbostratus
Schedule iRule
Im new in iRule. Im using a iRule and its ok, but i need to schedule this. I need that iRule to be enabled only a certain part of the day. How can I do that ? Thanks
Michael_Yates
Oct 12, 2012Nimbostratus
Hi Steve,
You can look on the CLIENT_ACCEPTED event Wiki page to see a list of available commands in that event.
You are correct that you cannot use an HTTP::redirect or HTTP::respond in that event. You could however set a flag / variable in this event that is picked up in the HTTP_REQUEST event and triggers a redirect.
Here's an example:
when CLIENT_ACCEPTED {
Check Client IP Address Exclusions GO HERE!
if { !([matchclass [IP::remote_addr] equals $::MaintenancePageOverride ]) } {
If it's not on the exclusion list. Tag it here.
set rewrite_response 1
} else {
If it is to be excluded, set value here.
set rewrite_response 0
}
}
when HTTP_REQUEST {
if { [HTTP::uri] contains "maintenanceaccess" } {
set rewrite_response 3
}
}
when HTTP_RESPONSE {
if { $rewrite_response equals "1" } {
HTTP::respond 200 content "Site unavailable
System Maintenance
NOTICE: This website down for system maintenance.
"
}
elseif { $rewrite_response equals "3" } {
HTTP::respond 200 content "Maintenance Access
Maintenance Access Assistance
Your IP Address is: [IP::client_addr]
Please provide the IP Address listed above to the Support Team Representative assisting you with
your maintenance window. This will allow the Representative to grant you override access to the
maintenance page.
Thank you.
"
}
}
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