IRules Logic and wild care at the end

I am trying to figure out a set of IRULES. They are working for the most part. Here is my issue. If the rules do not match my any of my uri (kinda like a wildcard) I want to redirect the connection to another site. Example I type in lms2.tyco-training.com into the address bar and I want to redirect it to http://lms.tyco-training.com/knav/nav?BU=10003010. If I put anything else after example : lms2.tyco-training.com/abc (does not match uri in my rules below I want it to go to this same page http://lms.tyco-training.com/knav/nav?BU=10003010. How do I add this wild card rule ?

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] starts_with “/dsc”} {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958”

} elseif { [string tolower [HTTP::uri]] starts_with “/kantech” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735”

} elseif { [string tolower [HTTP::uri]] starts_with “/acvs_catalog” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”

} elseif { [string tolower [HTTP::uri]] starts_with “/acvs” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”

} elseif { [string tolower [HTTP::uri]] starts_with “/mac” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”

} elseif { [string tolower [HTTP::uri]] starts_with “/tycosafetyproducts-fire-europe” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”

} elseif { [string tolower [HTTP::uri]] starts_with “/scansource” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”

} elseif { [string tolower [HTTP::uri]] starts_with “/SimplexMear” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”

} elseif { [string tolower [HTTP::uri]] starts_with “/te” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”

} elseif { [string tolower [HTTP::uri]] starts_with “/physicalsecurity” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”

} elseif { [string tolower [HTTP::uri]] starts_with “/swh” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”

} elseif { [string tolower [HTTP::uri]] starts_with “/tfbp” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”

} elseif { [string tolower [HTTP::uri]] starts_with “/scott” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”

} elseif { [string tolower [HTTP::uri]] starts_with “/bentel” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”

} elseif { [string tolower [HTTP::uri]] starts_with “/surgard” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”

} elseif { [string tolower [HTTP::uri]] starts_with “/amerdyn” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”

} elseif { [string tolower [HTTP::uri]] starts_with “/cemsys” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”

} elseif { [string tolower [HTTP::uri]] starts_with “/ADTContractors” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”

} else {

pool TIRCAP_76.24-80

}

}

THANKS IN ADVANCE

Can you try this:

when HTTP_REQUEST {  
    
   switch -glob [string tolower [HTTP::uri]] {  
    "/dsc*"  
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958" }  
    "/kantech*"    
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735" }  
    "/acvs_catalog*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409"}  
    "/acvs*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004408"}  
    "/mac*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005009"}  
    "/tycosafetyproducts-fire-europe*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005089"}  
    "/scansource*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004826"}  
    "/simplexmear*"  
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004867"}  
    "/te*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004768"}  
    "/physicalsecurity*"  
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004506"}  
    "/swh*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002734"}  
    "/tfbp*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004445"}  
    "/scott*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002988"}  
    "/bentel*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}  
    "/surgard*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}  
    "/amerdyn*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002733"}  
    "/cemsys*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002736"}  
    "/adtcontractors*"   
     { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005329"}  
    default {  
  if  {not ([string tolower [HTTP::uri]] starts_with "/knav/nav")}  {  
    HTTP::redirect "http://lms.tyco-training.com/knav/nav?BU=10003010"  
  }   
    }    
   }  
    
  }

Hmm … This one might be more efficient:

when HTTP_REQUEST {   
    if {not ([string tolower [HTTP::uri]] starts_with "/knav/nav")}  {   
   
    switch -glob [string tolower [HTTP::uri]] {   
     "/dsc*"   
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958" }   
     "/kantech*"     
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735" }   
     "/acvs_catalog*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409"}   
     "/acvs*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004408"}   
     "/mac*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005009"}   
     "/tycosafetyproducts-fire-europe*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005089"}   
     "/scansource*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004826"}   
     "/simplexmear*"   
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004867"}   
     "/te*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004768"}   
     "/physicalsecurity*"   
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004506"}   
     "/swh*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002734"}   
     "/tfbp*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004445"}   
     "/scott*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002988"}   
     "/bentel*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}   
     "/surgard*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}   
     "/amerdyn*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002733"}   
     "/cemsys*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002736"}   
     "/adtcontractors*"    
      { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005329"}   
     default  
      { HTTP::redirect "http://lms.tyco-training.com/knav/nav?BU=10003010" } 
    } 
  
   }     
  }

This is working great, ran into one more issue and I trying to figure out the logic..

We another Website on the same server

This URL:

http://lmsadmin2.tyco-training.com/assembler/dev

Redirects to:

http://lms2.tyco-training.com/knav/nav?BU=10003010

I dont want this site to redirect ? I want it to pass thru

Is there a way to make this work ?

Thanks again

What about this:

when HTTP_REQUEST {    
  
     if { not ( \ 
 ([string tolower {[HTTP::uri]}] starts_with "/knav/nav") or \ 
 ([string tolower "http://[HTTP::host][HTTP::path]"] eq \ 
 "http://lmsadmin2.tyco-training.com/assembler/dev") \ 
 ) }  {    
     
     switch -glob [string tolower [HTTP::uri]] {    
      "/dsc*"    
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958" }    
      "/kantech*"      
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735" }    
      "/acvs_catalog*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409"}    
      "/acvs*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004408"}    
      "/mac*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005009"}    
      "/tycosafetyproducts-fire-europe*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005089"}    
      "/scansource*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004826"}    
      "/simplexmear*"    
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004867"}    
      "/te*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004768"}    
      "/physicalsecurity*"    
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004506"}    
      "/swh*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002734"}    
      "/tfbp*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004445"}    
      "/scott*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002988"}    
      "/bentel*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}    
      "/surgard*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}    
      "/amerdyn*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002733"}    
      "/cemsys*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002736"}    
      "/adtcontractors*"     
       { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005329"}    
      default   
       { HTTP::redirect "http://lms.tyco-training.com/knav/nav?BU=10003010" }  
     }  
    
    }   
     
   }

If it didn’t work, try to use starts_with instead of eq in:

if { not ( \  
  ([string tolower {[HTTP::uri]}] starts_with "/knav/nav") or \  
  ([string tolower "http://[HTTP::host][HTTP::path]"] starts_with \  
  "http://lmsadmin2.tyco-training.com/assembler/dev") \  
  ) }  {

Need some more help. As they did more testing we realized none of the graphic coming up on the the redirect pages. The redirect was trying to grab a image but getting redirect by catch all at the end. I am in same position as the first post.

I am trying to figure out a set of IRULES. They are working for the most part. Here is my issue. If the rules do not match my any of my uri (kinda like a wildcard) I want to redirect the connection to another site. Example I type in lms2.tyco-training.com into the address bar and I want to redirect it to http://lms.tyco-training.com/knav/nav?BU=10003010. If I put anything else after example : lms2.tyco-training.com/abc (does not match uri in my rules below I want it to go to this same page http://lms.tyco-training.com/knav/nav?BU=10003010. How do I add this wild card rule ?

Is there a way around this ?

thanks again

Here was my original IRULE - this caused a loop over and over

when HTTP_REQUEST {

if { [HTTP::uri] starts_with “/dsc”} {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958”

} elseif { [HTTP::uri] starts_with “/kantech” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735”

} elseif { [HTTP::uri] starts_with “/acvs_catalog” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”

} elseif { [HTTP::uri] starts_with “/acvs” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”

} elseif { [HTTP::uri] starts_with “/mac” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”

} elseif { [HTTP::uri] starts_with “/tycosafetyproducts-fire-europe” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”

} elseif { [HTTP::uri] starts_with “/scansource” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”

} elseif { [HTTP::uri] starts_with “/SimplexMear” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”

} elseif { [HTTP::uri] starts_with “/te” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”

} elseif { [HTTP::uri] starts_with “/physicalsecurity” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”

} elseif { [HTTP::uri] starts_with “/swh” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”

} elseif { [HTTP::uri] starts_with “/tfbp” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”

} elseif { [HTTP::uri] starts_with “/scott” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”

} elseif { [HTTP::uri] starts_with “/bentel” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”

} elseif { [HTTP::uri] starts_with “/surgard” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”

} elseif { [HTTP::uri] starts_with “/amerdyn” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”

} elseif { [HTTP::uri] starts_with “/cemsys” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”

} elseif { [HTTP::uri] starts_with “/ADTContractors” } {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”

} else {

HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010”

}

}

this is what I have today and I am missing graphic.

when HTTP_REQUEST {

if {not ([string tolower [HTTP::uri]] starts_with “/knav/nav”)} {

switch -glob [string tolower [HTTP::uri]] {

“/dsc*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958” }

“/kantech*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735” }

“/acvs_catalog*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”}

“/acvs*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”}

“/mac*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”}

“/tycosafetyproducts-fire-europe*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”}

“/scansource*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”}

“/simplexmear*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”}

“/te*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”}

“/physicalsecurity*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”}

“/swh*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”}

“/tfbp*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”}

“/scott*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”}

“/bentel*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/surgard*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002960”}

“/amerdyn*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”}

“/cemsys*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”}

“/adtcontractors*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”}

default

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010” }

}

}

}

HELP

Here is the image gettng redirected via HTTP WATCH

what about this:

when RULE_INIT {  
  set ::ForwardList [list / .html .htm .asp .pl ]  
 }  
  
 when HTTP_REQUEST {     
    
   if { ( not ( \ 
  ([string tolower {[HTTP::uri]}] starts_with "/knav/nav") or \ 
  ([string tolower "http://[HTTP::host][HTTP::path]"] eq \ 
  "http://lmsadmin2.tyco-training.com/assembler/dev") \ 
  )) and ([matchclass [HTTP::path] ends_with $::ForwardList]) \ 
 }  {     
  
      switch -glob [string tolower [HTTP::uri]] {     
       "/dsc*"     
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958" }     
       "/kantech*"       
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735" }     
       "/acvs_catalog*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409"}     
       "/acvs*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004408"}     
       "/mac*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005009"}     
       "/tycosafetyproducts-fire-europe*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005089"}     
       "/scansource*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004826"}     
       "/simplexmear*"     
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004867"}     
       "/te*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004768"}     
       "/physicalsecurity*"     
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004506"}     
       "/swh*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002734"}     
       "/tfbp*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15004445"}     
       "/scott*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002988"}     
       "/bentel*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}     
       "/surgard*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002959"}     
       "/amerdyn*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002733"}     
       "/cemsys*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002736"}     
       "/adtcontractors*"      
        { HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15005329"}     
       default    
        { HTTP::redirect "http://lms.tyco-training.com/knav/nav?BU=10003010" }   
      }   
      
     }    
       
    }

Do you know why I would come up with this error for the above Irule

01070151:3: Rule [LMS_New_11-18] error:

line 7: [parse error: PARSE syntax 128 {syntax error in expression " ( not ( \

([string tolower {[HTTP::uri]}] starts_with …": character not legal in expressions}] [{ ( not ( \

([string tolower {[HTTP::uri]}] starts_with “/knav/nav”) or \

([string tolower “http://[HTTP::host][HTTP::path]”] eq \

“http://lmsadmin2.tyco-training.com/assembler/dev”) \

)) and ([matchclass [HTTP::path] ends_with $::ForwardList]) \

}]

Thanks

Make sure there is no space after “\”

I got it addded in, but know the redirects are not working. These things can drive you crazy

when RULE_INIT {

set ::ForwardList [list / .html .htm .asp .pl ]

}

when HTTP_REQUEST {

if { ( not ( \

([string tolower {[HTTP::uri]}] starts_with “/knav/nav”) or \

([string tolower “http://[HTTP::host][HTTP::path]”] eq \

“http://lmsadmin2.tyco-training.com/assembler/dev”) \

)) and ([matchclass [HTTP::path] ends_with $::ForwardList]) \

} {

switch -glob [string tolower [HTTP::uri]] {

“/dsc*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958” }

“/kantech*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735” }

“/acvs_catalog*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”}

“/acvs*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”}

“/mac*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”}

“/tycosafetyproducts-fire-europe*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”}

“/scansource*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”}

“/simplexmear*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”}

“/te*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”}

“/physicalsecurity*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”}

“/swh*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”}

“/tfbp*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”}

“/scott*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”}

“/bentel*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/surgard*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/amerdyn*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”}

“/cemsys*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”}

“/adtcontractors*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”}

default

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010” }

}

}

}

I think one issue is that this:

[string tolower {[HTTP::uri]}]

would return a literal string of [http::uri]. The curly braces prevent [HTTP::uri] being evaluated. You can remove them and it should work:

[string tolower [HTTP::uri]]

Aaron

I am think I am getting closer. Thanks for all the help so far. Here is the issue

Everytime it sees a jpg or css file it trys to redirect it so the jpg never comes up…it just redirects it to the default page on the bottom of the IRULE. see below

+ 0.8340.096499142GET302Redirect to http://lms2.tyco-training.com/knav/nav?BU=10003010http://lms2.tyco-training.com/knav/TKMStyleSheet/default/images/tyco\_bgimage.jpg

when RULE_INIT {

set ::ForwardList [list / .html .htm .asp .pl .jpg .css]

}

when HTTP_REQUEST {

if { ( not ( \

([string tolower [HTTP::uri]] starts_with “/knav/nav”) or \

([string tolower “http://[HTTP::host][HTTP::path]”] eq \

“http://lmsadmin2.tyco-training.com/assembler/dev”) \

)) and ([matchclass [HTTP::path] ends_with $::ForwardList]) \

} {

switch -glob [string tolower [HTTP::uri]] {

“/dsc*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958” }

“/kantech*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735” }

“/acvs_catalog*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”}

“/acvs*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”}

“/mac*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”}

“/tycosafetyproducts-fire-europe*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”}

“/scansource*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”}

“/simplexmear*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”}

“/te*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”}

“/physicalsecurity*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”}

“/swh*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”}

“/tfbp*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”}

“/scott*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”}

“/bentel*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/surgard*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/amerdyn*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”}

“/cemsys*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”}

“/adtcontractors*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”}

default

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010” }

}

}

}

Like always they have changed my requirements for the web app LB. here what they need me to do

Goes to this site

www2.tyco-training.com

Redirect to

http://lms2.tyco-training.com/knav/nav?BU=10003010

Goes to this site

www2.tyco-training.com/anything <----- whatever they type there could be /ABC or /hghdnsie

Redirect to

http://lms2.tyco-training.com/knav/nav?BU=10003010

Goes to

www2.tyco-training.com/dsc

Redirect to

http://lms2.tyco-training.com/knav/nav?BU=15002958

Goes to

http://lms2.tyco-training.com/kantech

Redirect to

http://lms2.tyco-training.com/knav/nav?BU=15002735

I need to make sure everything pass such as graphics. Do I need that forward list ? or better way to do it ?

For a graphic a url could be

http://lms2.tyco-training.com/knav/TKMStyleSheet/DSC\_Customers/images/tyco\_bgimage.jpg ( if I dont have the forward list (could become hugh) I will run into issue it would send it to the default page)

Here are rules I have tried , I want to see what the best logic is

This is the current one I have ( I know I need to remove the following line trying to remove it the proper what with out messing up my rules)

“http://lmsadmin2.tyco-training.com/assembler/dev”)

Here is my current rule

when RULE_INIT {

set ::ForwardList [list / .html .htm .asp .pl .jpg .css .jsp .gif]

}

when HTTP_REQUEST {

if { ([string tolower [HTTP::uri]] starts_with “/knav/nav”) or

([string tolower “http://[HTTP::host][HTTP::path]”] eq

“http://lmsadmin2.tyco-training.com/assembler/dev”) or

([matchclass [HTTP::path] ends_with $::ForwardList]) } {

return

} else {

switch -glob [string tolower [HTTP::uri]] {

“/dsc*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958” }

“/kantech*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735” }

“/acvs_catalog*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”}

“/acvs*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”}

“/mac*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”}

“/tycosafetyproducts-fire-europe*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”}

“/scansource*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”}

“/simplexmear*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”}

“/te*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”}

“/physicalsecurity*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”}

“/swh*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”}

“/tfbp*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”}

“/scott*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”}

“/bentel*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/surgard*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/amerdyn*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”}

“/cemsys*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”}

“/adtcontractors*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”}

default

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010” }

}

}

}

Ignore the post above. I have it up and running once again 90 percent. thanks

Here are my issue

Goes to this site This is not working

www2.tyco-training.com

Redirect to

http://lms2.tyco-training.com/knav/nav?BU=10003010

I need to make sure everything pass such as graphics. Do I need that forward list ? or better way to do it

For a graphic a url could be

http://lms2.tyco-training.com/knav/TKMStyleSheet/DSC\_Customers/images/tyco\_bgimage.jpg ( if I dont have the forward list (could become hugh) I will run into issue it would send it to the default page)

Here current irule

when RULE_INIT {

set ::ForwardList [list / .html .htm .asp .pl .jpg .css .jsp .gif]

}

when HTTP_REQUEST {

if { ([string tolower [HTTP::uri]] starts_with “/knav/nav”) or

([string tolower [HTTP::uri]] starts_with “/”) or

([matchclass [HTTP::path] ends_with $::ForwardList]) } {

return

} else {

switch -glob [string tolower [HTTP::uri]] {

“/dsc*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002958” }

“/kantech*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002735” }

“/acvs_catalog*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?cmd=catalog&BU=15004409”}

“/acvs*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004408”}

“/mac*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005009”}

“/tycosafetyproducts-fire-europe*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005089”}

“/scansource*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004826”}

“/simplexmear*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004867”}

“/te*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004768”}

“/physicalsecurity*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004506”}

“/swh*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002734”}

“/tfbp*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15004445”}

“/scott*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002988”}

“/bentel*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/surgard*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002959”}

“/amerdyn*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002733”}

“/cemsys*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15002736”}

“/adtcontractors*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=15005329”}

“/*”

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010”}

default

{ HTTP::redirect “http://lms2.tyco-training.com/knav/nav?BU=10003010” }

}

}

}

Requests for extensions which are defined in the forward list should not be redirected. So the .jpg request should make it to the pool without the full filename/path being defined in the forward list.

You could add some logging to the iRule, test and then check the /var/log/ltm log file. Here is a sample of the logging you could use:

when RULE_INIT { 
    set ::ForwardList [list / .html .htm .asp .pl .jpg .css .jsp .gif] 
 } 
  
 when HTTP_REQUEST { 
  
    log local0. "[IP::client_addr]:[TCP::client_port]: New request to [HTTP::uri] (path: [HTTP::path])." 
  
    if { ([string tolower [HTTP::uri]] starts_with "/knav/nav") or 
       ([string tolower [HTTP::uri]] starts_with "/") or 
       ([matchclass [HTTP::path] ends_with $::ForwardList]) } { 
  
       log local0. "[IP::client_addr]:[TCP::client_port]: Matched logic to skip redirects." 
  
       return 
  
    } else { 
       switch -glob [string tolower [HTTP::uri]] { 
          "/dsc*" { 
             log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::path] matched /dsc*." 
             HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958" 
          } 
          "/kantech*" { 
             log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::path] matched /kantech*." 
             HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735" 
          } 
          ... 
       } 
    } 
 }

Aaron