Forum Discussion

QNetOps_179308's avatar
QNetOps_179308
Icon for Nimbostratus rankNimbostratus
Apr 14, 2017

Enable event Processing after HTTP::respond

I currently have an iRule that responds directly from the F5 with the HTTP::respond event. However, I would also like other iRules which log request/response to fire but they are not. From my searches on DevCentral, it looks like invoking the HTTP::respond causes all other events to be bypassed. Is there any way to get around this so that the request/response are still logged correctly? I have tried surrounding the HTTP::respond with 'event enable' but that doesn't seem to help.

 

Thanks!

 

5 Replies

  • Do it last. All iRules can be associated with a priority in the format

    when EVENT priority X {
    

    So iRules of the same EVENT type run in priority sequence from 1 to 1000. The default priority when not specified is 500.

    Separate out your HTTP::respond to an iRule with a high priority than the rest so the other iRules run first.

    when HTTP_REQUEST priority 900 {
      HTTP::respond 200 content $my_data
    }
    
    • QNetOps_179308's avatar
      QNetOps_179308
      Icon for Nimbostratus rankNimbostratus

      I should have been more detailed. Currently our iRule logs during the HTTP_RESPONSE step (so that all the information needed for the logs are available when we are logging a normal response) and the iRule with the HTTP::respond is during the HTTP_REQUEST step. My understanding is that setting the priority wouldn't solve this particular scenario because later steps would never fire.

       

  • Move the HTTP::respond to the HTTP_RESPONSE event. This will overwrite the payload of the existing response and respond with what you provide. All previous events should trigger as you would expect.

     

    • QNetOps_179308's avatar
      QNetOps_179308
      Icon for Nimbostratus rankNimbostratus

      Yeah, the point of this particular iRule is to keep this request from hitting the real servers though...

       

    • Kevin_Davies_40's avatar
      Kevin_Davies_40
      Icon for Nacreous rankNacreous

      Well then you can't prevent the other events from being skipped. You are creating your own reply which means the request never arrives at the server and their is no response as a result.