Forum Discussion
PacketHead_4009
Dec 14, 2011Nimbostratus
Simple iRule with Sticky?
Hello, I'm trying to create what I think is a fairly simple iRule: when HTTP_REQUEST { if { [HTTP::uri] contains "/sites/tech*" } { pool Tech_Web_Pool_80 ...
hooleylist
Dec 16, 2011Cirrostratus
Hi James,
I assume you want requests for / and /default.aspx to go to the Tech_Web_Pool_80 pool then?
If you have specific exceptions for URIs you want to go to the main pool, you could try something like the example below to have them matched first. Note that I've added logic to parse the path and filename from the Referer header so you can check for / and /default.aspx there.
when HTTP_REQUEST {
Check the requested URI to see if it is a non-default pool request
switch -glob [string tolower [HTTP::uri]] {
"/sites/technology*" {
Use the main pool
pool Main_Web_Pool_80
}
"/" -
"/default.aspx*" -
"*/sites/tech*" -
"*/uri2/tech*" -
"*/uri3/tech*" {
pool Tech_Web_Pool_80
}
default {
No match on the URI, so check the Referer header
to see if it is a non-default pool request
Use URI::path and URI::basename to get the URI from the Referer header
set referer [string tolower [HTTP::header Referer]]
switch -glob "[URI::path $referer][URI::basename $referer]" {
"/sites/technology*" {
Use the main pool
pool Main_Web_Pool_80
}
"/" -
"/default.aspx*" -
"/sites/tech" -
"*/uri2/tech*" -
"*/uri3/tech*" {
pool Tech_Web_Pool_80
}
default {
No match on URI or Referer so use the main pool
pool Main_Web_Pool_80
}
}
}
}
}
Aaron
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