HTTP::enable

Description

Changes the HTTP filter from passthrough to full parsing mode. This could be useful, for instance, if you need to determine whether or not HTTP is passing over the connection and enable the HTTP filter appropriately, or if you have a protocol that is almost but not quite like HTTP, and you need to re-enable HTTP parsing after temporarily disabling it.
Use of this command can be extremely tricky to get exactly right; its use is not recommended in the majority of cases.
Note: This command does not function in certain versions of BIG-IP (v9.4.0 - v9.4.4). This issue is tracked as CR95437 and is fixed in BIG-IP v9.4.5.

Syntax

HTTP::enable

HTTP::enable

  • Change the http filter from passthrough to full parsing mode. Puts HTTP traffic filtering into full parsing mode (enabling the HTTP proxy) for the lifetime of the TCP connection or until HTTP::disable is called.

Examples

#
# This iRule should be used with a forwarding virtual server.
#
when CLIENT_ACCEPTED {
    HTTP::disable
    TCP::collect 4 0
    set server_hold 0
    log local0. "Buildup -- collecting data"
}
when CLIENT_DATA {
    # Since we're here, the clientside sent data first
    log local0. "Got client data"

    # Now see if this is a recognized HTTP command
    set command [TCP::payload 4]
    if { $command equals "GET " } {
        log local0. "HTTP traffic -- re-enabling HTTP processing"
        HTTP::enable
        if { $server_hold eq 1 } {
            serverside { TCP::release }
        }
        event SERVER_CONNECTED disable
        event SERVER_DATA disable
        return
    }
    log local0. "Not HTTP -- staying in passthru"
    event disable all
}
when SERVER_CONNECTED {
    log local0. "Server connection established"
    TCP::collect
    set server_hold 1
}
when SERVER_DATA {
    log local0. "Banner protocol -- staying in passthru"
    clientside { TCP::release }
    TCP::release
    event disable all
}
when HTTP_REQUEST {
   log local0. "Got request: [HTTP::uri]"
}