Forum Discussion

ryan_rockwell_1's avatar
ryan_rockwell_1
Icon for Nimbostratus rankNimbostratus
May 14, 2014

nested elseif unexpected behaviour

I created an iRule to (first) redirect to maintenance page and then if available redirect traffic to 1 of 3 pools based on URI data groups. The iRule compiles fine but the result is unexpected. The correct home page comes up but is missing parts and if I try any of the links the lead nowhere and the home page remains.

New rule:

when HTTP_REQUEST {
    if { [active_members INF-HEC-HTTP] < 1 } { 
    switch -glob [string tolower [HTTP::path]] {
      "_.gif" -
      "_.css" {
        HTTP::uri [string range [HTTP::uri] [string last / [HTTP::uri]] end]
      }
      default {
        HTTP::uri /
      }
    }
    pool QA-PH
  } elseif { [class match [string tolower [HTTP::uri]] starts_with QA-HEC-ENT-URI] } {
    pool INF-ENT-HTTP
  } elseif { [class match [string tolower [HTTP::uri]] starts_with QA-HEC-URI] } {
    pool INF-HEC-DNNREDIRECT
  } else { 
    pool INF-HEC-HTTP
  }
}

Old rule that works except for maintenace: and no uri

when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/ent/*" -
"/" 
{ pool QA-ENT-HTTP
return
}
}

switch -glob [string tolower [HTTP::uri]] {
"/site_includes/_" -
"/backoffice_newer_" -
"/emp_banner/_" -
"/media_kits/" -
"/promo/_" -
"/adproducts/" -
"/cst/ui/_" -
"/cst/backoffice/_" -
"/employer_" -
"/employer/" -
"/js-old/_" -
"/employer\asp" -
"/site_templates/_" -
"/assoclist.asp_"
{
pool QA-HEC-HTTP-DNNREDIRECT
}
default 
{ 
pool QA-HEC-HTTP
}
}
} 

21 Replies