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