When writing an iRule for an HTTP connection the actions performed are formulated around a series of events that occur. These events are based on the different steps involved in the HTTP connection process. They are the places that we’ve added in a hook to allow for the insertion of an iRule.

    It’s very helpful to know which events are available to you for a given connection type, as some commands are only available under certain events. Having a good understanding of the connection process will also allow you to make better use of the language by placing rules in the optimum location in the request process.

For a single connection here's the order of the HTTP events fired:

Request: All of these occur on the request portion of the connection, I.E. as the client is attempting to establish a connection to the server behind the BIG-IP. All data collected is data inbound from the client and any alterations made are passed on to the server.

CLIENT_ACCEPTED 
HTTP_REQUEST
HTTP_REQUEST_DATA (** if HTTP::collect called in HTTP_REQUEST)
LB_SELECTED
SERVER_CONNECTED
CLIENT_CLOSED (** This is the last event, regardless of when the connection is terminated)

Response: These events occur on the response of the connection, and are originating from the server to the client machine. All data collected is from the server and any alterations made are passed on to the client.

HTTP_REQUEST_SEND 
HTTP_RESPONSE
HTTP_RESPONSE_DATA (** if HTTP::collect called in HTTP_RESPONSE)
SERVER_CLOSED

    With a full view of the events involved, hopefully you’ll be able to appropriately place the iRules you’ll be creating, and leverage the order of events to your benefit.