For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

cdougall_14195's avatar
Apr 15, 2015

Logging a redirect generated from a different iRule.

We use a consistent iRule across our VIPs to log all requests. We have more specific iRules on some VIPs to perform URI based load balancing and in some cases redirects. The problem is that when a redirect is fired from one iRule, there's no entry in the request log.

Came across this : https://devcentral.f5.com/wiki/iRules.detect_prior_http_redirect_or_respond.ashx

when HTTP_REQUEST priority 999 {
 Ensure this event runs after any iRules which should take precedence over this one
 Check if an HTTP redirect/response has been triggered already.
    if { [catch {HTTP::payload replace 0 0 {}}] } {
        set already_responded 1
    } else {
        set already_responded 0
    }    
    if {$already_responded == 0}{
          Do something like select a pool or redirect the client
    }
}

This seems promising and provides a place to detect if a redirect was fired, but experimentation to this point hasn't provided a way to pull information from that redirect. Things like was it a 301 or a 302? what location the response was, etc.

Has anyone done something like this before? If I can't do it in a single place, might have to do it in each rule, but that could be significantly more maintenance. Thanks for the help.

3 Replies

  • You might be able to use procedures to accomplish the logging part of this. I don't know if you'd be able to set a variable and keep track of it within the procedure (if you needed to do that), but for simple logging, you could try that.

     

    • TejasPatil_3077's avatar
      TejasPatil_3077
      Icon for Nimbostratus rankNimbostratus

      Hey cdougall,

       

      Have you found solution for the problem? Can you please share your findings?