Forum Discussion

jackmoscow_2940's avatar
jackmoscow_2940
Icon for Nimbostratus rankNimbostratus
Dec 29, 2016

multiple conditions for redirect other pools

Good day, all!

Can you please tell how to make traffic redirection for multiple conditions and in different pools of sending traffic to these inspections, if there is no match to do a redirect traffic to the default pool of options for me were written in non-working.

when HTTP_REQUEST {
    if {[class match [string tolower [HTTP :: path]] starts_with "ABC"]} {
             pool SF_ABC
    } Else {
if {[class match [string tolower [HTTP :: path]] contains "/auto/hit"]} {
pool SF_AUTO
} Else {
pool default
}
}

1 Reply

  • Note that a "string tolower" comparison on the HTTP path will never match an upper-case string. A path always starts with a forward-slash. Also, watch out for embedded blanks.

    when HTTP_REQUEST { 
      if {[class match [string tolower [HTTP::path]] starts_with "/abc"]} {
        pool SF_ABC
      } elseif {[class match [string tolower [HTTP::path]] contains "/auto/hit"]} {
        pool SF_AUTO
      } else { 
        pool default
      }
    }