irule help for uri redirection

Hello Need some help on building an irule, very new to irules.

http://soft.abc.com/expo - would redirect the request to Expo server on a certain port (say 2000) http://soft.abc.com/granite - would redirect the request to Granite server on a certain port (say 4000) http://soft.abc.com/csg - would redirect the request to CSG server on a certain port (say 5000)

I understand the basic that I shall add node to a pool with certain port as a member and then use Http uri method in irule for redirection.

Thanks!

Here is what I build up and looking how to combine and if any correction to it Appreciate help if someone can look into it Thanks!

when HTTP_REQUEST { if { [HTTP::uri] contains “/expo” } { pool expo_pool port 2000 } else { pool all_pool } }

when HTTP_REQUEST { if { [HTTP::uri] contains “/granite” } { pool granite_pool port 4000 } else { pool all_pool } }

This is second one I build so far Please advise if any corrections or better options on it.

when HTTP_REQUEST {

if {[HTTP::uri] contains “/expo” } { pool granite_pool port 2000 }

if {[HTTP::uri] contains “/granite” } { pool granite_pool port 4000 }

if {[HTTP::uri] contains “/csg” } { pool csg_pool port 5000 }

}

Checked some irules on Dev Centeral seems port will be required with Node, if I mention Pool port is not required as pool will be configured with a member listening on port. I think this shall work, will be great if someone has done a similar request earlier. Getting familiar with irules little bit.

when HTTP_REQUEST { if { [HTTP::uri] contains “/expo” } { pool pool_expo }

if { [HTTP::uri] contains “/granite” } { pool pool_granite }

if { [HTTP::uri] contains “/csg” } { pool pool_csg

} else { pool default_pool }

}