Forum Discussion
Multiple iRules on Same VS not working
Hello guys,
I have 2 iRules similar to each other, with the only difference is the URI.
Only the first iRule gets triggered, either apply the iRule or skip, based on the URI
Tried to merge them into a single iRule, but a static variable caused an issue.
I have a variable in the
WHEN RULE_INIT
{
set static::myVariable "some string"
}
This static variable is set depending on the URI. So, I thought of merging both iRules into a single one, but this is not working due to this Variable.
So, now:
1) How can I get both iRules to be triggered?
2) How can I merge both, and set the static variable based on the URI?
Hello,
Yes you can easly.
The simple way to achieve your need is to merge your irule.
when RULE_INIT - Will allow you to set an var
when CLIENT_ACCEPTED - L4, yo can't manage restriction based on URI
when HTTP_REQUEST - you can manage URI/URL (L7)
when HTTP_RESPONSE - http response L7
Example:
when RULE_INIT { set static::myVariable "some string" } when CLIENT_ACCEPTED { ... } when HTTP_REQUEST { witch -glob [string tolower [HTTP::path]] { "/uri1" { # Apply your need 1 } "uri2" { # Apply your need 2 } default { # Apply your default need } } when HTTP_RESPONSE { ... }
you just have to manage all your uses cases well and sequence the actions...
if you send me your irules privately i can do it for you.
regards
- youssef1Cumulonimbus
Hi Guy,
can you published your Irule, it wil be more easier to help you with code.
Or can you describe your both irule because if you have an HTTP::response or redirert... it will be normal that the second irule will not be executed. In all case published your Irule and I will help you.
Thank you
- islam_nadimCirrus
Hello Youssef,
Unfortunately, I can't share my iRule. But both iRules have:
when RULE_INIT { when CLIENT_ACCEPTED { when HTTP_REQUEST { when HTTP_RESPONSE {
I need to apply the iRules based on the URI. IS this something possible?
Both iRules do exactly the same, with just a different string for a static variable in the "when RULE_INIT" section which I need to set the string for it based on the URI to be able to use a single iRule instead
- youssef1Cumulonimbus
Hello,
Yes you can easly.
The simple way to achieve your need is to merge your irule.
when RULE_INIT - Will allow you to set an var
when CLIENT_ACCEPTED - L4, yo can't manage restriction based on URI
when HTTP_REQUEST - you can manage URI/URL (L7)
when HTTP_RESPONSE - http response L7
Example:
when RULE_INIT { set static::myVariable "some string" } when CLIENT_ACCEPTED { ... } when HTTP_REQUEST { witch -glob [string tolower [HTTP::path]] { "/uri1" { # Apply your need 1 } "uri2" { # Apply your need 2 } default { # Apply your default need } } when HTTP_RESPONSE { ... }
you just have to manage all your uses cases well and sequence the actions...
if you send me your irules privately i can do it for you.
regards
What's the firmware version of your F5?
Mayur
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