13-Apr-2017 17:21
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!
13-Apr-2017 17:32
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
}
14-Apr-2017 07:27
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.
14-Apr-2017 16:57
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.
14-Apr-2017 19:26
Yeah, the point of this particular iRule is to keep this request from hitting the real servers though...
15-Apr-2017 05:14
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.