Forum Discussion

naladar_65658's avatar
naladar_65658
Icon for Altostratus rankAltostratus
Dec 02, 2008

Question about the "Switch" Command

Hello all,

 

 

I have a question about using the "Switch" command. Listed below are two iRules. The only difference is that in one I am trying to use a data group and in the other the strings are just listed out. The strings listed in the "proofpoint_uri" data group are the exact strings listed in iRule that does work, so /enduser/* is an example of one of the strings contained within the data group.

 

 

The question I have is why does referencing the data group from the switch using the -glob arguement not work? Maybe for it to work it would require using a regular expression? (not recommended or desired)

 

 

I am just curious....

 

 

Here are the iRules:

 

 

This is the iRule that does NOT work. Traffic goes to the default, but traffic matching the strings in the proofpoint_uri does not go to the Proofpoint_Pool, it all goes to the default.

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri] ] {

 

$::proofpoint_uri {

 

pool Proofpoint_Pool

 

}

 

default {

 

pool ExchangeHub_Web_Pool

 

}

 

}

 

}

 

============================================

 

This is the iRule that does work

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri] ] {

 

"/enduser/*" -

 

"/images/*" -

 

"/js/*" -

 

"/res/*" -

 

"/script/*" {

 

pool Proofpoint_Pool

 

}

 

default {

 

pool ExchangeHub_Web_Pool

 

}

 

}

 

}