Forum Discussion
Multiple iRules on Same VS not working
- Jun 15, 2020
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
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
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
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