Forum Discussion

hilledegraaf_29's avatar
hilledegraaf_29
Icon for Nimbostratus rankNimbostratus
Sep 28, 2018

iRules "Operation not supported" log errors

We want to insert a HTTP header with the following name "client-ip" in a HTTP Request which has the value of the Client Source IP address. But we also want to check if this header exist, and if it does, remove that header and insert a new one. Also if there are more than 1 client-ip headers, remove all those headers first.

We made the following iRule, and that seems to work:

when HTTP_REQUEST {
   if { [HTTP::header exists "client-ip"] } {
      foreach aHeader [HTTP::header client-ip] {
         HTTP::header remove client-ip
      }
      HTTP::header insert client-ip [IP::client_addr]
   } else {
   HTTP::header insert client-ip [IP::client_addr]
   }
}

But we see a lot of errors in the LTM log which looks like these:

Sep 27 08:37:08 err tmm9[19631]: 01220001:3: TCL error: /Common/request_insert_client-ip - Operation not supported (line 7) invoked from within "HTTP::header insert client-ip [IP::client_addr]"

Is the iRule causing this error, because "something" is wrong within the iRule content? If we look at the iRule statistics we see no errors in the execution of this iRule. We are running version 12.1.2-HF2

Any help would be appreciated.

Hille

  • From the HTTP::header insert help page:

     

    "If this command is executed after issuing the HTTP::redirect or HTTP::respond command, the F5 will become confused, generate an "Operation Not Supported" TCL error and reset the connection."

     

    Do you have another iRule assigned to the virtual server? If so, take care with the order and possibly use priority to ensure that this runs first.

     

    You should also check whether the header is already present using HTTP::header exists and then use replace to replace it. Basically, add some error prevention code around the insert.