Forum Discussion
Luca_55898
Jun 27, 2011Nimbostratus
Redirect to TCP port based on URL
Hello,
We have an Alteon load balancer that will be replaced with an LTM very soon.
We have a pool of two servers which run a bunch of different websites. The sites all use the s...
Ryan_Paras_7933
Jul 07, 2011Nimbostratus
You may want to explore using datagroups (classes) so that you don't have to edit the irule every time you want to add or remove a URI/pool combo.
If you are only concerned with a top level directory, here is some code that may help you out:
rule topdir_to_pool {
when HTTP_REQUEST {
extracting the top level directory name
set HTTPtopdir [lindex [split [string tolower [HTTP::uri]] /] 1]
seeing if the top level directory name in our the server_pool class
if {[class match $HTTPtopdir equals server_pool]} {
extracting the pool associated with the top level directory
set HTTPtopdir_pool [class lookup $HTTPtopdir server_pool]
log local0. "request for $HTTPtopdir, using pool $HTTPtopdir_pool"
using the pool found associated to the top level directory
pool $HTTPtopdir_pool
}
implicit else, where we fall back to the default pool defined in the virtual server config
}
}
class server_pool {
{
"customers" { "pool-82" }
"employees" { "pool-81" }
"new_users" { "pool-83" }
}
}
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