Forum Discussion

johnko05_45751's avatar
johnko05_45751
Icon for Nimbostratus rankNimbostratus
Jul 25, 2008

Virtual Hosts

My application requires numerous VIPs (20+) in order to operate. This obviously requires high numbers of public and private addresses. Can someone send me an example of an iRule to use Virtual Hosts? Basically this would allow me to use one VIP and based on the port and protocol of the request, it would be directed to the appropriate pool. This would reduce my IP requirements and make things much more manageable. Thanks in advance!

1 Reply

  • If the application uses HTTPS, this becomes more complicated as you can only really support one SSL cert on a single VIP. Here is one method for HTTP where you select the pool based on the HTTP host header value:

     
     when HTTP_REQUEST [ 
      
         Make a pool selection based on the host header value (set to lowercase) 
        switch [string tolower [HTTP::host]] { 
           "test1.example.com" { 
               test1 
              log local0. "[IP::client_addr]:[TCP::client_port]: test1.example.com, using test1 pool" 
              pool test1_pool 
           } 
           "test2.example.com" { 
               test2 
              log local0. "[IP::client_addr]:[TCP::client_port]: test2.example.com, using test2 pool" 
              pool test2_pool 
           } 
           "test3.example.com" { 
               test3 
              log local0. "[IP::client_addr]:[TCP::client_port]: test2.example.com, using test3 pool" 
              pool test3_pool 
           } 
           default { 
               didn't match specific case 
              log local0. "[IP::client_addr]:[TCP::client_port]: hit default, using pool1" 
              pool test1_pool 
           } 
        } 
     } 
     

    I'm guessing this won't exactly match your scenario, but hopefully it gets you started.

    Aaron