Forum Discussion
Yugandhar
Nimbostratus
Jul 18, 2018Reason for iRule Execution Error
Hi
Multiple URLs are pointing to the same Virtual Server IP but persistence of 600 secs is needed only for a few of them.
Configured the below iRule and applied to the VS but got an Execution er...
youssef1
Cumulonimbus
Jul 19, 2018Hi Yugandhar.
You have a syntax problem. your condition need to be explicit for each value.
you can't set one condition with multiple value. look what you should have done:
if { [string tolower [HTTP::host]] equals "access.testxyz45.com" or [string tolower [HTTP::host]] equals equals "abc.testxyz45.com" or [string tolower [HTTP::host]] equals "def.testxyz45.com" or [string tolower [HTTP::host]] equals "mail.testxyz45.com" } {
persist source_addr [IP::client_addr] 600
} else { }
By the way you have to optimise your irule by set your host variable:
set host [string tolower [HTTP::host]]
if { $host == "access.testxyz45.com" || $host == "abc.testxyz45.com" || $host == "def.testxyz45.com" || $host == "mail.testxyz45.com" } {
persist source_addr [IP::client_addr] 600
} else { }
and finally you have to optimize his irula for his execution as shown by lee:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
switch -glob $host {
"access.testxyz45.com" -
"abc.testxyz45.com" -
"def.testxyz45.com" -
"mail.testxyz45.com" {
persist source_addr [IP::client_addr]
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects