Forum Discussion

ryan_rockwell_1's avatar
ryan_rockwell_1
Icon for Nimbostratus rankNimbostratus
Jun 12, 2014

Unknown behavior on iRule

I have an iRule that reads several statements:

    when HTTP_REQUEST {
  if { [active_members QA-HEC-HTTP] < 1 } {
    switch -glob [string tolower [HTTP::path]] {
      "images/*" - 
      "*.gif" -
      "*.jpg" -
      "*.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-SEARCH-URI]) and ([HTTP::cookie value "EnterpriseIntegration"] equals "True") } {
     pool QA-ENT-HTTP
   } elseif { [HTTP::uri] equals "/" } {
    pool QA-ENT-HTTP
    } elseif { ([class match [string tolower [HTTP::uri]] starts_with QA-HEC-ENT-URI]) and ([HTTP::cookie value "EnterpriseIntegration"] equals "True") } {
    pool QA-ENT-HTTP
    } elseif { [class match [string tolower [HTTP::uri]] starts_with QA-HEC-URI] } {
    pool QA-HEC-HTTP-DNNREDIRECT
  } else {
    pool QA-HEC-HTTP 
  } 
}

I believe this rule reads traffic and A) Checks that servers are available and if so continues on to the next section and if not sends traffic to the QA-PH pool B) does a read on the URI and checks if a string starts with a entry in QA-HEC-ENT-SEARCH and checks a value of a cookie, if true then sends traffic to QA-ENT-HTTP pool C) checks URI and if true sends to QA-ENT-HTTP pool. D) does a read on the URI and checks if a string starts with a entry in QA-HEC-ENT-SEARCH and checks a value of a cookie, if true then sends traffic to QA-ENT-HTTP pool E) does a read on the URI and checks if a string starts with a entry in QA-HEC-ENT-SEARCH and if true then sends traffic to QA-HEC-HTTP-DNNREDIRECT pool F) All else traffic goes to QA-HEC-POOL.

The problem I'm running into is that somehow the URL is being rewritten. If I go to the homepage and the cookie is true it comes up fine. Next I click on a link that is included in the QA-HEC-ENT-SEARCH-URI group and it should read http://www.healthecareers.qa/search-academics-research-jobs/?specialty=Academics+%2f+Research

but actually comes back as: (basically doubling the query string) http://www.healthecareers.qa/search-academics-research-jobs/?specialty=Academics+%2f+Research&specialty=Academics+%2f+Research

If I host file my machine directly to one of the servers in the QA-ENT-HTTP pool everything works fine and the URL is correct. I don't see any kind of rewrite in my rule. Any thoughts/suggestions?

1 Reply

  • The quickest and easiest troubleshooting tool you have at this point would be to throw some log statements inside each comparison to know for sure what is matching. Then you can correlate the redirect with being assigned to a given pool.

     

    log local0. "Insert custom log statement here"

     

    It seems like one or more of the backend pool members is issuing a redirect.