Forum Discussion

Rusty_Hale_8009's avatar
Rusty_Hale_8009
Icon for Nimbostratus rankNimbostratus
Jan 16, 2007

I need help converting old 4.X rules into new 9.X irules

I have three rules that use classes defined in them. The classes are already built. I just need to convert the syntax to V9. I would appreciate any help on this. I am on a short timeline or I would hammer it out. Thanks in advance.

 

 

1.

 

if (http_uri contains one of NCR_MO_HighRateURI or client_addr == one of NCR_MO_HighRateIP) {

 

use pool Alamo_http_MO_robotic

 

}

 

else {

 

use pool Alamo_MO_Http

 

}

 

 

2.

 

if (client_addr == one of HighRateIP_Exclude) {

 

use pool NCR_MO_HTTP

 

}

 

else if (http_uri contains one of NCR_MO_HighRateURI or client_addr == one of NCR_MO_HighRateIP) {

 

use pool NCR_MO_HTTP_HighRate

 

}

 

else {

 

use pool NCR_MO_HTTP

 

}

 

 

3.

 

if (http_uri contains one of NCR_MO_HighRateURI or client_addr == one of NCR_MO_HighRateIP) {

 

use pool NCR_MO_HTTPS_HighRate

 

}

 

else {

 

use pool NCR_MO_HTTPS

 

}

 

 

2 Replies

  • 1:

    when HTTP_REQUEST {
      if { ([matchclass [HTTP::uri] contains $::MCR_MO_HighRateURI]) ||
           ([matchclass [IP::client_addr] equals $::NCR_MO_HighRateIP]) } {
        pool Alamo_http_MO_robotic
      } else {
        pool Alamo_MO_Http
      }
    }

    2:

    when HTTP_REQUEST {
      if { [matchclass [IP::client_addr] equals $::HighRateIP_Exclude] } {
        pool NCR_MO_HTTP
      } elseif { ([matchclass [HTTP::uri] contains $::NCR_MO_HighRateURI]) ||
                 ([matchclass [IP::client_addr] equals $::NCR_MO_HighRateIP]) } {
        pool NCR_MO_HTTP_HighRate
      } else {
        pool NCR_MO_HTTP
      }
    }

    3:

    when HTTP_REQUEST {
      if { ([matchclass [HTTP::uri] contains $::MCR_MO_HighRateURI]) ||
           ([matchclass [IP::client_addr] equals $::NCR_MO_HighRateIP]) } {
        pool NCR_MO_HTTPS_HighRate
      } else {
        pool NCR_MO_HTTPS
      }
    }

    Note: these aren't tested so you might want to make sure I got all the class and pool names correct but this should give you something to start with.

    -Joe