Forum Discussion

jkirankumar1993's avatar
jkirankumar1993
Icon for Nimbostratus rankNimbostratus
Feb 08, 2018

irule to divert traffic - Not Working

when HTTP_REQUEST {

 set referrer_host [URI::host [HTTP::header value Referer]]

if { $referrer_host equals "jiratest.corp.chartercom.com"} {
if { [string tolower [HTTP::uri]] contains "/rest/" } {
pool JIRA-test-pool
}

}


if { $referrer_host not equals "jiratest.corp.chartercom.com" } {
if { [string tolower [HTTP::uri]] contains "/rest/" } {
if { [string tolower [HTTP::uri]] equals "/login.jsp" }{
pool JIRA-test-pool
}
else{
 pool JIRA-test-external-pool
    }
     }
}

pool JIRA-test-pool


}


Error:

01070151:3: Rule [/Common/jira-divertingtraffic] error: /Common/jira-divertingtraffic:13: error: [parse error: PARSE syntax 247 {syntax error in expression " $referrer_host not equals "jiratest.corp.chartercom.com" ": extra tokens at end of expression}][{ $referrer_host not equals "jiratest.corp.chartercom.com" }]

/Common/jira-divertingtraffic:18: error: [undefined procedure: else{][else{]

Someone please help me. I am new to this.

  • Hi, you have a syntax error "not equals" is not valid. Please try the following:

    when HTTP_REQUEST {
      set referrer_host [URI::host [HTTP::header value Referer]]
    
      if { $referrer_host equals "jiratest.corp.chartercom.com"} {
        if { [string tolower [HTTP::uri]] contains "/rest/" } {
          pool JIRA-test-pool
        }
      }
    
    
      if { !($referrer_host equals "jiratest.corp.chartercom.com") } {
        if { [string tolower [HTTP::uri]] contains "/rest/" } {
          if { [string tolower [HTTP::uri]] equals "/login.jsp" }{
            pool JIRA-test-pool
            } else {
              pool JIRA-test-external-pool
            }
          }
        }
    
    pool JIRA-test-pool
    
    }