Forum Discussion

efzc_104887's avatar
efzc_104887
Icon for Nimbostratus rankNimbostratus
Dec 11, 2007

domain bypass ?

There are two member pools (pool_a and pool_b)set in the system. I would like to set the irules such that when the users access www.abc.com and www.def.com, the system will use pool_a. When the users access the other domain, the system will use pool_b. I would like to use switch statement so that I can add more domain in future. Would someone please check my following is correct or not?

 

 

when HTTP_REQUEST {

 

switch -glob [HTTP::host] {

 

abc.com

 

def.com {

 

pool pool_a

 

}

 

default {

 

pool pool_b

 

}

 

}

 

}

 

P.S. my Big-IP version is 9.1.2 40.2

 

Many Thanks.

2 Replies

  • Hi,

    That looks like a good start. You should add a hyphen after abc.com so that def.com is considered as part of the same condition. Also, if you're not using wildcards, you can remove the -glob flag. Finally, the host header isn't case sensitive, so you could set it to lower case before doing your comparison.

    
    when HTTP_REQUEST {
       switch [string tolower [HTTP::host]] {
          abc.com -
          def.com {
             pool pool_a
          }
          default {
             pool pool_b
          }
       }
    }

    Aaron
  • thanks for your information, Aaron. I'll have a try in testing environment