is this irule ok?!

i’ve used the irule editor to check but it doesn’t seem to be working correctly i.e. www.mainsite.com doesn’t work but www.mainsite.com/subsite does work!..

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] starts_with “/subsite” or “/subsites”} {

pool subsite_pool

}

else {

pool main_pool

}

}

the previous irule worked fine but didn’t do everything we needed…

when HTTP_REQUEST {

if { [HTTP::uri] starts_with “/subsite”} {

pool subsite_pool

}

else {

pool main_pool

}

}

this has knocked out one of our production web sites so i’d appreciate any input

many thanks

i think i’ve solved it with the following irule…

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] starts_with “/subsite”} {

pool subsite_pool

}

elseif { [string tolower [HTTP::uri]] starts_with “/subsites”} {

pool subsite_pool

}

else {pool main_pool}

}

You were close with your initial attempt. Whenever you’re using a logical operator like or, you have to repeat the comparison operator as well. Like this:

when HTTP_REQUEST { 
   if { ([string tolower [HTTP::uri]] starts_with "/subsite") or ([string tolower [HTTP::uri]] starts_with "/subsites")} { 
     pool subsite_pool 
   } else { 
     pool main_pool 
   } 
 }

Realistically though, starts_with /subsite includes starts_with /subsites anyway, so you should only need the one comparison.

So really, this should get you there:

when HTTP_REQUEST { 
   if { [string tolower [HTTP::uri]] starts_with "/subsite"} { 
     pool subsite_pool 
   } else { 
     pool main_pool 
   } 
 }

hth,

Colin