Forum Discussion

Stephan_Manthe1's avatar
Stephan_Manthe1
Icon for Nimbostratus rankNimbostratus
Sep 30, 2016

ADAPT::enable not valid in context of HTTP_REQUEST_DATA

Hi,

I'm writing an iRule to pass HTTP POSTs selectively through an ICAP proxy.

Using the
ADAPT::enable request <0|1>
works fine in the context of
HTTP_REQUEST
as described in a couple of threads.

As I'm parsing a multipart upload (potentially consisting of multiple files) for specific files (based on the file extension and announced Content-Type; information can be found in the payload only and is not part of the request headers) I have to use HTTP::collect first.

Finally I want to decide in the context of
HTTP_REQUEST_DATA
to bypass the ICAP or not.

Unfortunately the
ADAPT::enable request <0|1>
is not permitted in this context:

[command is not valid in current event context (HTTP_REQUEST_DATA)][ADAPT::enable request 1]

(I have tried both TMOS v11.5.4HF2 and TMOS v12.1.1HF1 resulting in the same error message.)

Any idea how to get this fixed?

Using a second virtual server might be an option.

(Btw, there is already a virtual server in front of it to terminate SSL as I have to use
TCP::respond
to return 100 Continue interim responses for the incoming POSTs.)

Collecting all POST data on TCP level and doing the analytics in context of
CLIENT_DATA
might be another option. Thanks in advance for your ideas,

Cheers, Stephan

1 Reply

  • Hi Stephan,

    Out of couriosity, did you already tried to hide the ADAPT syntax from the iRule sytax validation? It will at least allow you to save the iRule and hopefully also allow you to execute the command.

    set cmd {
        ADAPT::enable request <0|1>    
    }
    eval $cmd
    

    Note: Selectively passing the request to a VIP-targeting-VIP would be also my next choice... 😉

    Cheers, Kai