Forum Discussion

jjenkins334_439's avatar
jjenkins334_439
Icon for Nimbostratus rankNimbostratus
Oct 12, 2012

New to iRules and Tcl

I'm new to iRules, and tcl. I have two url's blabla.test.com and blabla1.test.com, that resolve to the same IP address. My customer wants blabla1 to only go to one private ip address, and blabla to loadbalance between two private ip addresses. I created two pools for this purpose, and wrote the following rule:

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] contains "blabla1.test.net" } {

 

pool test1_pool

 

} else {

 

pool test_pool

 

}

 

}

 

 

Unfortunately, everything falls through to the second pool, even uri's with blabla1 in them. I've tried various combinations of syntax, but can't get the first statement to be recognized. Any advice?

 

Thanks in advance,

 

 

John Jenkins

 

3 Replies

  • Welcome John. Try this - with '.com' - took me a while to spot that!

    
    when HTTP_REQUEST {
     if { [HTTP::host] equals "blabla1.test.com" } {
      pool test1_pool }
     else {
      pool test_pool }
    }
    

  • Thanks, I'll give that a try. The .com vs. .net thing was actually just a fat finger on my part, a result of rushing because my wife was standing at the door waiting on me. It should have all been .net.