Forum Discussion

dennypayne's avatar
dennypayne
Icon for Employee rankEmployee
Aug 16, 2010

External datagroup strange behavior

I'm trying to make an external data group a little more bulletproof and ensure that if a key gets uploaded without a value that the below iRule doesn't attempt to redirect. What is happening however is that when the client requests www.domain.com/answers2 with the configuration below, they get redirected to the site that is listed as the value for /answers.

It seems like a bug in the way the LTM is parsing the external class file, because we are setting REDIR_LOC back to null in the rule. When the client comes in with /answers2 REDIR_LOC should also return null, so the 2nd "if" should return 0 and not process the redirect and the log statements. Yet we see the log state "URI is /answers2 redir to http://www.domain.com/wiki". So somehow it's inserting the value for the previous key in the wrong place.

Any thoughts on how to avoid this? (Besides programatically sanitizing the input via some sort of script)


when HTTP_REQUEST {
   if {[ class match [HTTP::uri] eq domainonline_cs ]} {
     set "REDIR_LOC" [class match -value [HTTP::uri] eq domainonline_cs]
       if {$REDIR_LOC ne ""} {
         HTTP::redirect $REDIR_LOC
         log local0. "URI is [HTTP::uri] redir to $REDIR_LOC"
         set REDIR_LOC ""
      } else {
         return
      }
   }
}

domainonline_cs datagroup file:

--- sample ---

"/answers" := " http://www.domain.com/wiki",

"/answers2",

3 Replies

  • Are you seeing any TCL errors? If you don't have a value in your datagroup, I'd expect you to get an error saying "no such variable - REDIR_LOC" or something like that.
  • No, the log file only showed the entry we generated from within the rule, except for once when we actually added the := seperator into the class file manually. We got an error then, don't recall what it was.

     

  • If you are seeing a TCL error that would be a good place to start. Else, I'd add debug logging for the REDIR_LOC variable and check the logs.

     

     

    Aaron