Forum Discussion
Dbow_21284
May 19, 2011Nimbostratus
More efficient iRule needed
Hello,
I have a Virtual Server that I just setup for SharePoint. SharePoint hosts about 15 sites which the business lines all want Load Balanced. The challenge for me was that I did not wa...
hooleylist
May 19, 2011Cirrostratus
The optimal method for selecting a pool would be a check of the host header and mapping that to a corresponding pool name without going through all possible pool names (whether in an if/elseif/.../else chain, a switch statement or a datagroup). The logic would be something like this:
when CLIENT_ACCEPTED {
Save the name of the default pool
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
Check if Host header ends with my domain
if {[string tolower [HTTP::host]] ends_with ".example.com"}{
Try assigning a pool in the format of subdomain1_http_pool
from a host header value of subdomain1.example.com
if {[catch {pool [getfield [HTTP::host] "." 1]_http_pool} result]}{
log local0. "[IP::client_addr]:[TCP::client_port]: Error assigning pool [getfield [HTTP::host] "." 1]_http_pool for [HTTP::host]"
pool $default_pool
}
}
}
If you can't create a pool based just on the subdomain of the Host header value, you could create a datagroup which maps the host names to pool names and then use the class command to do the lookup.
Just to clarify, every TCP packet is not inspected with any of these iRules. LTM will only collect enough TCP packets to parse the HTTP headers of the requests. This happens when you have an HTTP profile on the virtual server--regardless of whether an iRule is used or not.
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