Redirect uri /raj to same pool but with different port

Hi,

Please help:

www.testrule.com = pool_abc:1245

www.testrule.com/raj = pool_abc:9876

Then I created this irule and applied to www.testrule.com VS:

when HTTP_REQUEST {

if { [HTTP::uri] contains “/raj” } {

pool pool_abc:9876

} else {

pool pool_abc:1245

}

}

but it’s not working.

Is this correct? Am I missng anything with rgards to server port? Could you please help me?

Thanks!

Raj

.

Hi Raj,

If you define the collection of IP:ports for the /raj URIs in one pool and the other IP:ports in a second pool, you can use an like this to select between the two pools:

when HTTP_REQUEST {
   switch -glob [HTTP::uri] {
      "/raj*" {
         pool poo_raj_abc
      }
      default {
         pool pool_abc
      }
   }
}

Aaron

You could also use the node command to send to a specific node and port combination if you can’t configure the pools properly, but Aaron’s solution above is the most simple and scalable.

Colin

Hi Aaron

If you create 2 pools as above , so u need to create 2 vs , right?

vs1 ------ port 1245

vs2-------port 9876

Posted By dragon on 02/12/2011 07:24 PM

Hi Aaron

If you create 2 pools as above , so u need to create 2 vs , right?

vs1 ------ port 1245

vs2-------port 9876

Nope, LTM will perform port translation for you. Your VS can be port 80, pool 1 members can listen at 1245, pool 2 members can listen at 9876, and LTM will translate the destination port from 80 to whichever port for which the members are configured.