Forum Discussion
nrelihan_68143
Nimbostratus
Aug 02, 2011Must the iRule always select a pool?
Hey,
In my iRule I plan to use two pools, pool_bots and pool_default. Bot and crawler traffic will be sent to pool_bots and pool_default wil be used for all other traffic.
So just to be clear can I put this iRule on a virtual server that is pointing towards pool_default so I dont have to put in the line "pool pool_default" in the switch statment code?
Im just not 100% on the mechanics of the F5 Im afriad.
Thanks,
Neil
when HTTP_REQUEST {
set hostname [string tolower [HTTP::host]]
set uri [string tolower [HTTP::uri]]
if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } {
pool pool_bots}
else {
switch [whereis [IP::client_addr]] {
"IE" {
if {$hostname eq "www.example.com" and not $uri starts_with "/ireland"} {
HTTP::redirect http://www.example.com/ireland/[HTTP::uri] } }
"GB" {
if {$hostname eq "www.example.com" and not $uri starts_with "/ireland" } {
HTTP::redirect http://www.example.co.uk/[HTTP::uri]
}
}
default {
if {$hostname eq "www.example.com" and not $uri starts_with "/ireland" } {
HTTP::redirect http://www.example.com/region-selectpage}
}
}
}
- Michael_Yates
Nimbostratus
You are correct. - hoolio
Cirrostratus
A small note: if you're on 9.4.4 or higher, you should remove the $:: prefix from the datagroup name. Pre-v10 this was a best practice, but in v10 and higher, it's a requirement for the rule to work.
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