Forum Discussion
junland_314810
Nov 16, 2017Nimbostratus
Port Redirection Failure
I'm using a Non-Prod F5 running 12.1.2 Build 1.292.271.
We have a cluster of nodes that serve up various Apps on different ports.
/App1 - 80
/App2 - 81
/App3 - 82
I have configured a pool ...
Lee_Sutcliffe
Nov 16, 2017Nacreous
You can't use the
pool
command in LB_SELECTED as the load balancing decision has already been made.
Try placing your pool command in HTTP_REQUEST
(you also had a missing end quote in the switch)
https://devcentral.f5.com/wiki/iRules.pool.ashx
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/App1*" {
set port 80
}
"/App2*" {
set port 81
}
"/App3*" {
set port 82
}
}
if {([info exists port]) && ($port ne "")} {
pool [LB::server pool] member [LB::server addr] $port
}
}
PS - Pool command added inside an
if
, this is because the $port variable may not exist if a connection arrives with a different URI to the one in the switch statement. If this happens you'll get a TCL error. 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