Forum Discussion

Manuel_60430's avatar
Manuel_60430
Icon for Nimbostratus rankNimbostratus
Mar 25, 2014

TCL error message with X-Forwarded-For iRule

We are using the X-Forwarded-For http header field on the BigIP LTM to server our webshop application with client IP addresses (to determinde country hawk and so on). Our web application can only work with exactly one IP address in this field. Due to the fact that more IPs are possible I've written a little iRule, where I check if the field already exists and in case, removes it and write it new. So far, so good ...

Now we are using a contend delivery network in front of one of our web clusters. They deliver the client IP address in a custom header field, called True-Client-IP. So I've modified my iRule to check a) if the X-Forwarded-For field exists as above b) check if we have a True-Client-IP field and if yes, change this to a X-Forwarded-For field that our application knows what to do.

I receive regularly the following error message: Operation not supported (line 3) invoked from within "HTTP::header remove X-Forwarded-For"

Can anyone explain me what this means and how I can get rid of this error logs? Of course I would also be happy for any suggestions on improvement (I'm a network guy, no programmer :-))

Thanks, Manuel

iRule:


      when HTTP_REQUEST {
           Always need to remove any existing XFF headers.
          if {[HTTP::header exists X-Forwarded-For]}{
              HTTP::header remove X-Forwarded-For
          }
           If the ‘True-Client-IP’ header exists use it, otherwise just use client address.
          if {[HTTP::header exists True-Client-IP]}{
             HTTP::header replace X-Forwarded-For [HTTP::header value True-Client-IP]
          } else {
              HTTP::header replace X-Forwarded-For [IP::client_addr]
          }
        }


11 Replies