Forum Discussion

harton's avatar
harton
Icon for Nimbostratus rankNimbostratus
Feb 23, 2011

Host to pool mapping

Hello, we are running version 9.4.6, and I've been asked to see if there is a way to map hosts to pools to reduce the number of public IPs we use.

 

 

Previously, we were doing the normal www.xyz.com/customer, but do to an application change we now have to specify the customer in the host.

 

 

 

We currently have to configure a separate public VIP for each one of our customers. We would like to be able use only one public IP, but be able to direct the customer to a specific pool based on the host. Here's an example:

 

 

 

customer1.xyz.com send to pool1

 

customer2.xyz.com send to pool2

 

customer3.xyz.com send to pool3

 

etc.

 

 

 

 

 

Here's one idea I had, but it's not scalable if I have a lot of customers.

 

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::host]] {

 

if { [HTTP::host] starts_with "customer1" } {

 

pool pool1

 

elseif { [HTTP::host] starts_with "customer2" } {

 

pool pool2

 

elseif { [HTTP::host] starts_with "customer3" } {

 

pool pool3

 

}

 

}

 

 

 

 

Is there a better way to do this? I have about 50 customers I need to configure this for.

 

 

 

Thanks,

 

Harton

 

2 Replies

  • Either a switch statement or a datagroup mapped to pool name as value would be my choices.

    In the example above, you don't actually use both the switch statement and the if/else. It would look like this:

     
     when HTTP_REQUEST { 
         switch -glob [string tolower [HTTP::host]] { 
               "customer1*" { pool pool1 } 
               "customer2*" { pool pool2 } 
               "customer3*" { pool pool3 } 
        } 
     } 
      

    If there's a character mapping between customer and pool, you could make this extremely easy...where something like "customerx = poolx"
  • harton's avatar
    harton
    Icon for Nimbostratus rankNimbostratus
    Wow. This looks simple enough. I'll give it a try. I was way over thinking this one.

     

     

    Thanks for the quick reply.