Forum Discussion

Chris_G_Davis_1's avatar
Chris_G_Davis_1
Icon for Nimbostratus rankNimbostratus
Nov 17, 2008

URI iRule Logic

Help!

 

 

Attempting to write an iRule that matches multiple uri's. If uri matches it's sent to the appropriate pool, if not but partially right it gets rewritten correctly and sent to appropriate pool, if no matches it gets logged & rejected.

 

 

iRule Editor complaining;

 

 

line 7: [deprecated usage, use else or elseif] [ ]

 

 

---------------------------------------------

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "/cce-presentation-kiosk-a3/live.html"} {

 

pool A3-KCI

 

} elseif

 

{ [HTTP::uri] ends_with "/cce-presentation-kiosk-a3/" } {

 

log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"

 

HTTP::uri "/cce-presentation-kiosk-a3/live.html"} {

 

pool A3-KCI

 

elseif { [HTTP::uri] equals "/cce-presentation-kiosk-fv/live.html"} {

 

pool FV-KCI

 

} elseif

 

{ [HTTP::uri] ends_with "/cce-presentation-kiosk-fv/" } {

 

log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"

 

HTTP::uri "/cce-presentation-kiosk-fv/live.html" {

 

pool FV-KCI

 

} else {

 

log local0. "URI doesn't match; rejecting connection http://[HTTP::host]/[HTTP::uri]"

 

reject

 

}

 

}

 

}

 

}

 

-------------------

 

 

Thanks,

 

 

Christopher G Davis

 

Sr. Network Engineer

 

SITA Atlanta Data Center

 

Mobile: +1 404.431.7280

 

E-mail:Chris_G.Davis@sita.aero

 

 

1 Reply

  • Try this:

      
      when HTTP_REQUEST {  
       if { [HTTP::uri] equals "/cce-presentation-kiosk-a3/live.html"} {  
        pool A3-KCI  
       } elseif { [HTTP::uri] ends_with "/cce-presentation-kiosk-a3/" } {  
        log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"  
        HTTP::uri "/cce-presentation-kiosk-a3/live.html"  
        pool A3-KCI  
       } elseif { [HTTP::uri] equals "/cce-presentation-kiosk-fv/live.html"} {  
        pool FV-KCI  
       } elseif { [HTTP::uri] ends_with "/cce-presentation-kiosk-fv/" } {  
        log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"  
        HTTP::uri "/cce-presentation-kiosk-fv/live.html"   
        pool FV-KCI  
       } else {  
        log local0. "URI doesn't match; rejecting connection http://[HTTP::host]/[HTTP::uri]"  
        reject  
       }  
      }  
      

    I found some syntax errors in if then elseif block.