Forum Discussion

tkancianich_925's avatar
tkancianich_925
Icon for Nimbostratus rankNimbostratus
Nov 03, 2008

Having issues converting 4.5 irule to v9.3

Not real familiar in creating or manipulating irules. Any assistance would be grateful & much appreciated ,thank you for taking a look!

 

 

Here is the rule I need to put on my v9.3 LTM:

 

 

if (http_uri contains ".nyk") {

 

redirect to "http://www2.nykline.com/redirect/SiteDown.html"

 

}

 

else if (http_uri contains ".nyks") {

 

redirect to "http://www2.nykline.com/redirect/SiteDown.html"

 

}

 

else {

 

use pool pSidewinderNAT.80

 

}

2 Replies

  • This should be equivalent for 9.x:

     
     when HTTP_REQUEST { 
        if {[HTTP::uri] contains ".nyk"}{  
           HTTP::redirect "http://www2.nykline.com/redirect/SiteDown.html"  
        } elseif {http_uri contains ".nyks"}{ 
           HTTP::redirect "http://www2.nykline.com/redirect/SiteDown.html"  
        } else {  
           pool pSidewinderNAT.80  
        } 
     } 
     

    You could also replace the if/elseif/else with a switch command:

     
     when HTTP_REQUEST { 
      
        switch -glob [HTTP::uri] { 
           "*.nyk*" - 
           "*.nyks*" { 
              HTTP::redirect "http://www2.nykline.com/redirect/SiteDown.html"  
           } 
           default { 
              pool pSidewinderNAT.80  
           } 
        } 
     } 
     

    Aaron