Forum Discussion
Redirecting request to different pools based on port number
I have two application servers as members to multiple pools. I currently created multiple VS with unique port service.
As you can see from example below, I would like users to be able to, lets say if in first url page (tuesday), click a link to "friday". It currently works as intended but I have to create VS for each port. I want to reduce the number of VS and conserve the IP addresses.
I am unable to test this because lack of testing environment. And as irule newbie, I dare not monkey with production network.
when HTTP_REQUEST {
switch -glob [HTTP::host] {
http://example.mtd.today.com:8088/tuesday/ { pool Stagin_Pool }
http://example.mtd.today.com:8089/wednesday/ { pool Management_Pool }
http://example.mtd.today.com:8090/thursday/ { pool Development_Pool }
http://example.mtd.today.com:8091/friday/ { pool Test_Lab_Pool }
default { pool Production_Pool }
}
}
Thanks for your help.
1 Reply
- Kevin_Stewart
Employee
You don't have to create multiple VIPs at all. With the iRule you have here, minus the port numbers, you can host all of the applications on a single IP and port. I should also point out that [HTTP::host] is only returning the host name and not the URI, so because the host name is the same for all of these, you can create a single VIP and modify your iRule to look something like this:when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/tuesday*" { pool Stagin_Pool } "/wednesday*" { pool Management_Pool } "/thursday*" { pool Development_Pool } "/friday*" { pool Test_Lab_Pool } default { pool Production_Pool } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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