Forum Discussion

Albert__Tase_70's avatar
Albert__Tase_70
Icon for Nimbostratus rankNimbostratus
Dec 11, 2006

need help convert this irule to 9.2.4

if (http_host contains "npg.nature.com") {

 

use pool pressandgateway

 

}

 

else if (http_host contains "press.nature.com") {

 

use pool pressandgateway

 

}

 

else {

 

discard

 

}

 

1 Reply

  • You could use an if statement like this:

    when HTTP_REQUEST {
      if { [HTTP::host] contains "npg.nature.com" } {
        pool pressandgateway
      } elseif { [HTTP::host] contains "press.nature.com" } {
        pool pressandgateway
      } else {
        discard
      }
    }

    or... you could go with a switch statement which allows for a logical or by using a "-" terminator on a comparison string.

    when HTTP_REQUEST {
      switch -glob [HTTP::host] {
        "*npg.nature.com*" -
        "*press.nature.com*" {
          pool pressandgateway
        }
        default {
          discard
        }
      }
    }

    Your choice...

    -Joe