Forum Discussion
Travis_Langtry_
Nimbostratus
Jan 16, 2009HTTP::URI
Hi all,
I am trying to write an iRule to make the following work:
1. Traffic sent to http://www.domain.com will use the default pool for the virtual server.
2. Traffic sent to http://www.domain.com/learn/ will get sent to a different pool.
The following is what I have written:
when HTTP_REQUEST {
if { [string tolower [ HTTP::uri ]] starts_with "/learn" } {
log local0. "1st Log For Request: [HTTP::uri]"
pool learn-test
log local0. "2nd Log For Request: [HTTP::uri]"
}
}
when I try to go to http://www.domain.com/learn, I get the following in the log files:
Jan 16 16:04:35 tmm tmm[1098]: Rule wirefly-learn-test : 1st Log For Request: /learn
Jan 16 16:04:35 tmm tmm[1098]: Rule wirefly-learn-test : 2nd Log For Request: /learn
The log statenents seem to work fine, however, no traffic is ever sent to the learn-test pool. The counters for the pool do not increment, and no traffic is generated to the server that is in the pool.
When I remove the iRule and set learn-test as the default pool for the virtual server, I can reach http://www.domain.com/learn just fine.
Any Ideas?????
3 Replies
- Colin_Walker_12Historic F5 AccountThat logic looks like it should work just fine. There are no error messages cropping up? Have you tried using the same iRule to send traffic to a different pool, by chance?
Could it be something with that pool? The logic looks fine, so I'm trying to recall if perhaps there's an issue with "-" in the pool name? I'll dig around and see what I can find.
Colin - Travis_Langtry_
Nimbostratus
Here are the entries from the config file tor the virtual server, pools, and iRules:
virtual learn {
destination 10.2.4.100:http
ip protocol tcp
profile http tcp-lan-optimized
persist source_persist_600
pool Test
rule learn-test test-bot-shunt
}
pool Test {
lb method member observed
action on svcdown reset
monitor all check_www
member 10.2.1.11:http
}
pool learn-test {
lb method member observed
action on svcdown reset
monitor all check_www
member 10.2.1.237:http
}
pool bot-shunt {
lb method observed
action on svcdown reset
monitor all check_www
member 10.2.1.170:any
member 10.2.1.248:any
}
rule learn-test {
when HTTP_REQUEST {
if { [string tolower [ HTTP::uri ]] starts_with "/learn" } {
log local0. "1st Log For Request: [HTTP::uri]"
pool learn-test
log local0. "2nd Log For Request: [HTTP::uri]"
}
}
}
rule test-bot-shunt {
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*googlebot*" -
"*slurp*" -
"*msnbot*" -
"*majestic12*" -
"*spider*" -
"*crawler*" -
"*robot*" -
"*scanalert*" -
"*redcarpet*" {
Send bots to the bot pool
pool bot-shunt
}
default {
Send all other requests to a default pool
pool Test
}
}
}
} - Jennifer_Davis2
Nimbostratus
when HTTP_REQUEST {
set URI_lower [string tolower [HTTP::uri]]
if {$URI_lower starts_with "/learn" } {
pool learn-test
}
else {pool default_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
