Forum Discussion
Elias_O_16228
Nimbostratus
Apr 22, 2013Redirecting request based on port number
I have two application servers as pool members to multiple pools. I want to be able to load balance based on port.
For example, If a user click first link, load balance staging pool. If user is...
Kevin_Stewart
Employee
Apr 23, 2013"[string tolower [HTTP::host]]:[TCP::local_port][string tolower [HTTP::uri]]" is going to evaluate the host, port, and URI, so your switch conditions will have to contain all three of those values.
ex. "example.mtd.today.com:8088/tuesday" { pool Stagin_Pool }
Also, if there's a chance that there's something after the "/tuesday" URI, then you should use switch -glob and make sure your switch conditionals end with a wildcard (star character).
ex. ex. "example.mtd.today.com:8088/tuesday*" { pool Stagin_Pool }
My other points were this:
1. If the host value IS ALWAYS THE SAME (ex. "example.mtd.today.com"), then there's probably no reason to include that in the evaluation.
2. If the port and URI are specific to a service (ex. port 8088 and URI "/tuesday"), then there's probably no reason to evaluate both. In other words, evaluate either the URI or the port.
Last, you can't capture the protocol specifier with these commands, so you should leave it out of the switch evaluation.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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