Forum Discussion
Irule behavior for persistence
Hello there, I am going to use an irule like below for redirection,
{ when http::URI starts with "EBI" http::redirect pool "abc-pool-443" } Else { pool "abc-pool-80" }
=========
Question is, if i want to enable persistence for both the pools when they are being used, can i add that statement within the irule, FYI, i have a source persistence set for default profile on the virtual server, will that work for both the pools without having a statement inside the rule, please clarify.
- Lee_Sutcliffe
Nacreous
Firstly, your iRule will not work as the syntax is incorrect. You'll also need to prefix your URI with a "/" otherwise the starts_with operator will not match as intended.
Please see an example of a working iRule:
when HTTP_REQUEST { if {[HTTP::uri] starts_with "/EBI"} { pool abc-pool-443 } else { pool abc-pool-80 } }
Secondly - for this type of iRule, you would be best to use an Local Traffic Policy, not an iRule as they are designed for this simple conditions and do not require any iRule coding knowledge.
Finally, if you have a persistence profile assigned to the virtual server and you are happy using the same method for each pool, you do not need to worry about setting persistence in an iRule as the persistence record will be written after the load balancing decision has been made to the selected pool member. This would be the same if you opted to use a local traffic policy over an iRule
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