Forum Discussion
How do I create Sequential or Linked iRules?
I have an iRule currently which is programmatically updated by a web app as web applications are deployed. It works great. Basically it redirects PRODSITE.COM/CLIENTSPECIFCURI to a PRODSERVERPOOL based on /CLIENTSPECIFICURI.
I'd like to create an iRule ahead of it such that anything arriving to TESTSITE.COM goes to TESTSERVERPOOL. Because of the programatically generated nature of the PRODSITE iRule, I'd like to avoid putting code into it if possible.
Can anyone shed some light on this for me?
- You can assign multiple iRules to a given virtual. Just use the "priority" command to tell the LTM what order to process them in. Details are in the "priority" API documentation in the iRules wiki at
https://devcentral.f5.com/wiki/iRules.priority.ashx
I believe I wrote an article on iRule events a while back too that might shed some light onto things.
https://devcentral.f5.com/Tutorials...vents.aspx
Hope that helps...
-Joe
- Chase_Hoffman_2NimbostratusJoe,
That get's a little more difficult as there isn't a direct way to call an iRule from another iRule. What you'll need to do is to create a session variable to handle state and you. Here's some pseudo code that may help
priority 100
when HTTP_REQUEST {
set PROCESS_IRULE_PRODSITE 1;
if { [HTTP::host] eq "testsite" } {
Assign target pool (if this is the default pool, this can be omitted).
pool testsite
Do not process prodsite iRule
set PROCESS_IRULE_PRODSITE 0;
}
}
priority 200
when HTTP_REQUEST {
if { $PROCESS_IRULE_PRODSITE == 1 } {
Do something
}
}
I think that's what you are going after.
-Joe
- GavinW_29074Nimbostratus
Are there only the 2 rules assigned to the VIPs doing Pool assignment?
As if that's the case, couldn't you just use 'Event disable' in your test iRule if it's a test connection...
when HTTP_REQUEST { if { [HTTP::host] eq "testsite" } { Assign target pool (if this is the default pool, this can be omitted). pool testsite Do not process prodsite iRule event disable } }
Cheers
Gav
- Chase_Hoffman_2NimbostratusJoe,
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