Forum Discussion

Chris_Robert_10's avatar
Chris_Robert_10
Icon for Nimbostratus rankNimbostratus
Jan 22, 2009

sub site iRule

I have been asked to help in a site redesign.

 

 

They want to have 12 sub sites go to one set of servers and everything else go to another set.

 

 

The URL must not change in the users browser.

 

 

So they want

 

www.mysite.com/site1/

 

www.mysite.com/site2/

 

www.mysite.com/site3/

 

......

 

www.mysite.com/site12/

 

 

To go to one set of servers and www.mysite.com/sitewhatever/ to go to another set of servers.

 

 

I currently have two separate pools and two separate virtual servers setup.

 

 

Everything I have tried has not produced what they want.

 

 

Anyone have any suggestion?

 

 

Thanks,

 

Chris

1 Reply

  • Hi Chris,

    You could use a single VIP which www.mysite.com resolves to. You could then use an iRule to send requests for /site1/ - /site12/ to one pool and all other URIs to the second pool. If that sounds about right, you could use an iRule like this:

      
      when HTTP_REQUEST {  
        
          Check the requested path  
         switch -glob [HTTP::path] {  
            "/site[1-9]/* -  
            "/site1[1-2]/* {  
        
                Request matched /site1/* - /site12/* so use first pool  
               pool first_pool  
        
               log local0. "[IP::client_addr]:[TCP::client_port]: Using first_pool for request to [HTTP::uri]"  
            }  
            default {  
                Request didn't match so use second pool  
               pool second_pool  
        
               log local0. "[IP::client_addr]:[TCP::client_port]: Using second_pool for request to [HTTP::uri]"  
            }  
         }  
      }  
      

    If you see omega Ώ symbols in the switch statement, replace the lines wtih these (minus the spaces):

    "/site [ 1 - 9 ]/* -

    "/site1 [ 1 - 2]/* {

    Aaron