Forum Discussion

geffryti_32102's avatar
geffryti_32102
Icon for Nimbostratus rankNimbostratus
Feb 24, 2010

Help please... my irule fails all the time

Help please! I can't see what's wrong with my iRule, v9 F5 just says that it's failing based on the stats.

 

 

 

when HTTP_REQUEST {

 

if { $HTTP::uri == "/wi/wpi_jp.jsp" } {

 

HTTP::redirect "https://abc.com/wi/wpi_jp.jsp"

 

} elseif { $HTTP::uri == "/sp2" } {

 

HTTP::redirect "http://abc.com:8086/rtpatch/sp2"

 

} elseif { $HTTP::uri == "/ub" } {

 

HTTP::redirect "http://abc.com:8086/rtpatch/ub"

 

} elseif { $HTTP::uri == "/wpi" } {

 

HTTP::redirect "http://abc.com:8082/wpi/wpi_jp.jsp"

 

} elseif { $HTTP::uri == "/IET" } {

 

HTTP::redirect "http://abc.com:8086/IET"

 

} else { HTTP::redirect "http://abc.com[HTTP::uri]"

 

}

 

}

4 Replies

  • Changed one thing in hoolio's code example, was missing a quote on the first entry:

     

     

     
      when HTTP_REQUEST {  
        
          Check the requested URI  
         switch [HTTP::uri] {  
            "/wi/wpi_jp.jsp" {  
               HTTP::redirect "https://abc.com/wi/wpi_jp.jsp"  
            }  
            "/sp2" {  
               HTTP::redirect "http://abc.com:8086/rtpatch/sp2"  
            }  
            "/ub" {  
               HTTP::redirect "http://abc.com:8086/rtpatch/ub"  
            }  
            "/wpi" {  
               HTTP::redirect "http://abc.com:8082/wpi/wpi_jp.jsp"  
            }  
            "/IET" {  
               HTTP::redirect "http://abc.com:8086/IET"  
            }  
            default {  
               HTTP::redirect "http://abc.com[HTTP::uri]"  
            }  
         }  
      }  
     
  • Thanks for that. You should add yourself to that list :D

     

     

    That would make a good start to an index page for people who are beginning to work with iRules. You could even include links to the iRule wiki and the tutorials.

     

     

    Aaron