Forum Discussion
Yugandhar
Nimbostratus
Jun 15, 2018Pool Selection and Persistence using iRule
Hi,
Can we forward traffic to a particular pool based on the host(domain) section of the URL and apply persistence of 500ms using the below iRule.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "ad.test.xya.com" } {
pool xya_Test--pool
} elseif { [string tolower [HTTP::host]] equals "bc.test.xya.com" } {
pool xya_Test--pool
} elseif { [string tolower [HTTP::host]] equals "vf.test.xya.com" } {
pool xya_Test--pool
persist 500
} elseif { [string tolower [HTTP::host]] equals "lg.test.xya.com" } {
set clientip [IP::remote_addr]
pool xya_Test--pool
persist uie $clienip 500
}else {
pool Default_VIP--pool
}
}
Thanks,
Yugandhar.
Yes it's possible to forward traffic to a specific pool based on the HTTP host header. As far as I know it's not possible to persist with a timeout specified in milliseconds. The timeout for persistence should be in seconds. For an iRule like this, it's better to use the switch function. See example below.
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "ad.test.xya.com" { pool xya_Test--pool } "bc.test.xya.com" { pool xya_Test--pool } "vf.test.xya.com" { pool xya_Test--pool } "lg.test.xya.com" { pool xya_Test--pool persist source_addr } default { pool Default_VIP--pool } } }
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