Forum Discussion
Assigning multiple iRULES to a VIP
Hello All, I need your suggestion on assigning multiple iRULES to the same VIP. What would be the best approach to be followed while assigning multiple iRULES to the same VIP? - Does the traffic to the VIP will be processed in sequential order? for instance the first irule in the list process the traffic first and then the second irule in the list of irules assigned to the VIP and then the third iRULE in the list?
- Does LTM support Nested irule for example calling an another irule from the irule? Regards, T.K
- Hannes_Rapp
Nimbostratus
If you do not use Priority command, then all iRules are silently allocated priority of 500. All equal. Then the order in which they are mapped to Virtual Server will have significance, as you already guessed. But this is bad practice with no benefits. Occasional bugs due to config reload can mess up the order those rules are mapped to your Virtual Servers.
Note that only the current event that is taking place will be affected by
command.priority
A snapshot of how multiple iRules are actually processed will look as follows
RULE_INIT event of iRule that has priority (or event priority) set to 1 ... RULE_INIT event of iRule that has priority set to 999 ... HTTP_REQUEST event of iRule that has priority set to 1 ... HTTP_REQUEST event of iRule that has priority set to 999 ...
Does LTM support Nested irule for example calling an another irule from the irule?
- With standard TCL iRules, nope. Maybe you can do it with iRulesLX but cannot confirm.
Regards,
- Thiyagu_343098
Nimbostratus
Thanks a lot Hannes for your reply. If suppose there are two iRULES first one for inserting the client IP and second one for content switching based on URI?
Could you please help me to know in which order I have add the iRULES?
Regards, Thiyagu
- jaikumar_f5
Noctilucent
Why do you need 2 irule for the above scenario, both take place in http request event, can't you achieve both in a single Irule. Or am i missing something here. Can you post both your Irules.
- Thiyagu_343098
Nimbostratus
Hi Jai, Here is the irules: First, when HTTP_REQUEST { set rd "%[ROUTE::domain]" set client_ip [string map "$rd \"\"" [IP::client_addr]] HTTP::header insert srcaddr $client_ip }
Second, when HTTP_REQUEST { if {[HTTP::uri] starts_with "/uri1" } { pool pool1 } elseif {[HTTP::uri] starts_with "/uri2" } { pool pool2 } elseif {[HTTP::uri] starts_with "/uri3" } { pool pool3 } }
Would I able to merge both the irules without the flow of the application to the application servers based on the URI?
Regards, Thiyagu
- jaikumar_f5
Noctilucent
yes that should work,
when HTTP_REQUEST { set rd "%[ROUTE::domain]" set client_ip [string map "$rd \"\"" [IP::client_addr]] HTTP::header insert srcaddr $client_ip if {[HTTP::uri] starts_with "/uri1" } { pool pool1 } elseif {[HTTP::uri] starts_with "/uri2" } { pool pool2 } elseif {[HTTP::uri] starts_with "/uri3" } { pool pool3 } else { pool default } }
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