Forum Discussion

Elias_O_16228's avatar
Elias_O_16228
Icon for Nimbostratus rankNimbostratus
Apr 22, 2013

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

  • 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 }
         }
    }