Forum Discussion

Leslie_South_55's avatar
Leslie_South_55
Icon for Nimbostratus rankNimbostratus
Sep 25, 2007

Simple pool selection using URI not so simple...

Greetings once again, I am trying to select a pool based on content in the URI; what I am seeing is the first request selects the pool correctly, but requests that follow are using the default pool.

VS with cookie insert persistence

default pool defined in the VS resource

rule looks like this

when HTTP_REQUEST {
 if { [HTTP::uri] contains "en_CA" } { 
use pool pool_cananda 
   log local0. "Canada request - canada pool"
}
else { use pool pool_us  }
   log local0. "using default pool"
}

here are some log entries

Sep 25 12:13:39 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:46 tmm tmm[1055]: Rule rule_test-can_redirect : Canada request - canada pool

Sep 25 12:17:46 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:50 tmm tmm[1055]: Rule rule_test-can_redirect : Canada request - canada pool

Sep 25 12:17:50 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : Canada request - canada pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

Sep 25 12:17:57 tmm tmm[1055]: Rule rule_test-can_redirect : using default pool

What am I missing?

-L
  • Here's the code you gave, reformatted a bit:

     

    
    when HTTP_REQUEST {
      if { [HTTP::uri] contains "en_CA" } { 
        use pool pool_cananda 
        log local0. "Canada request - canada pool"
      }
      else {
        use pool pool_us
      }
      log local0. "using default pool"
    }

     

     

    I think it's just your logging that's off. Notice that your "using default pool" log is outside the else statement, so it will display that every time. Try this:

     

     

    
    when HTTP_REQUEST {
      if { [HTTP::uri] contains "en_CA" } { 
        use pool pool_cananda 
        log local0. "Canada request - canada pool"
      }
      else {
        use pool pool_us
        log local0. "using default pool"
      }
    }

     

     

    and see if it changes.
  • we can mark this one in the "DOOHH" category; it turns out that I had another rule that I use to trasfert HTTP to HTTPS and in that rule, there was an 'else pool pool_us" statement. This was causing the traffic to be sent to the US pool, once I removed it, it redirects correctly.

     

     

    Thanks for the eyes on this, guess I just need to slow down.

     

    -L