Forum Discussion

rajesh1's avatar
rajesh1
Icon for Nimbostratus rankNimbostratus
Apr 12, 2010

Irules - Help

Hi,

 

I need some assistance in writing an irule

 

 

for the following requirement for the http requests

 

 

1)Http://xyz.com redirect to "http://www.xyz.com"

 

2)If all the pool members are down - redirect "http://www.xyz.com" or "http://xyz.com" to "http://www2.xyz.com"

 

3)If LB_Failed then fall back to "http://www2.xyz.com"

 

 

Is it recommended to have a single irule defined to match all the three requirements or 3 different irules for each requirements.

 

Pls provide me with an irule definitions.

 

Thanks, Raj

1 Reply

  • Hello Raj,

     

     

    I haven't tested this but the following may do what you require:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] equals "xyz.com"} {

     

    HTTP::redirect "http://www.xyz.com"

     

    }

     

    }

     

    when LB_FAILED {

     

    HTTP::redirect "http://www2.xyz.com"

     

    }

     

     

     

    You can probably get rid of the 'LB_FAILED' bit and just use a fallback host in the http profile instead.

     

     

    let me know how you get on!