Forum Discussion
ML_108504
May 11, 2012Nimbostratus
Most efficient way to re-prioritize a virtual server's iRules?
Hi folks,
I'm writing a powershell script to add and remove a maintenance page redirect iRule to the top of a given virtual server's iRule list (TMOS versions 9.4.x and 10.x). Any given virtual se...
George_Watkins_
May 12, 2012Historic F5 Account
Hi ML,
Here's a little trick that might help. All iRules have a global priority and their individual events have priorities as well. By default, this priority is 500 if it is not defined in the iRule. If no priority are defined, then the iRules are executed based on the order in the web UI. If a lower priority (say 100) is defined for an iRule or its events, they will be executed before those with lower priorities regardless of their position in the list. There is a fair amount of documentation on the priority command in the DevCentral iRules Wiki.
What I would do is just set a higher priority for the maintenance iRule and then just add it to begin maintenance,and delete it from the virtual server to end maintenance. The iRule might look like this:
priority 100
when HTTP_REQUEST {
HTTP::redirect "http://mysite.com/maintenance.html"
}
You can then just use the LocalLB::VirtualServer::add_rule and LocalLB::VirtualServer::remove_rule methods to add and delete the iRule. You can put the iRule in any order and it should always fire first.
Hope that helps,
-George
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