Forum Discussion

rodrigo_Benzaqu's avatar
rodrigo_Benzaqu
Icon for Nimbostratus rankNimbostratus
Oct 03, 2006

Need Help to Migrate Rule from V4 to V9

Hi Guys,

 

 

I have to move the following Rule from v4.x to V9.x. I,m trying to use "case" instead of "if", but it´s giving me syntax error:

 

 

 

rule Cache_Fetch {

 

if (http_uri starts_with "/jm/pms" or http_uri starts_with "/cgi/pms/") {

 

use pool PMS_java

 

}

 

else {

 

if (http_uri starts_with "/jm/" or http_uri starts_with "/jms/" or http_uri starts_with "/servlet/" or http_uri ends_with "_JM

 

" or http_uri ends_with "_JSEA" or http_uri starts_with "/dwr/") {

 

use pool Java_Servers

 

}

 

else {

 

if (http_uri contains "/ml/") {

 

use pool SQL_Servers

 

}

 

else {

 

use pool static_server

 

}

 

}

 

}

 

}

 

 

 

 

thanks for your help,

 

 

Rodrigo

1 Reply

  • I'd use a switch statement myself...

    when HTTP_REQUEST {
      switch -glob [HTTP::uri] {
        "/jm/pms*" -
        "/cgi/pms/*" {
          pool PMS_java
        }
        "/jm/*" -
        "/jms/*" -
        "/servlet/*" -
        "*_JM" -
        "*_JSEA" -
        "/dwr/*" {
          pool Java_Servers
        }
        "*/ml/*" {
          pool SQL_Servers
        }
        default {
          pool static_server
        }
      }
    }

    I think I've got all of your starts_with and ends_with correct, but you should double check.

    Hope this helps...

    -Joe