Forum Discussion

Srinivasan_G_31's avatar
Srinivasan_G_31
Icon for Nimbostratus rankNimbostratus
Oct 29, 2012

iRule assistance - Combining iRules

Hi,

 

I want to combine following 2 iRules into 1. Please assist.

 

iRule 1

 

----------

 

when HTTP_REQUEST {

 

if { [HTTP::uri] contains "/abcd/" } {

 

pool abcdpool member 1.1.1.1 80

 

}

 

}

 

 

iRule 2

 

----------

 

when HTTP_REQUEST {

 

switch -glob [HTTP::path] {

 

"*[0-9][0-9][0-9][0-9]*" { pool abcdpool member 1.1.1.1 80

 

default abcdpool }

 

}

 

}

 

 

 

 

 

 

 

  • You can combine the two iRules to avoid any conflicts:

    
    when HTTP_REQUEST {
        switch -glob [HTTP::path] {
            "*/abcd/*" -
            "*[0-9][0-9][0-9][0-9]*" {pool abcdpool member 1.1.1.1 80}
            default {pool abcdpool}
        }
    }
    

    Aaron

  • Hi Aaron,

     

    Can i also include ".aspx" at the end of the numerics to be matched?

     

    Like "*[0-9][0-9][0-9][0-9].aspx*". Is this the right syntax?