For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Ben_Wilson_2412's avatar
Oct 09, 2013

eval is HTTP:response

I thought there was a way to include evaluated expressions in the HTTP:response command.

Something like

   when HTTP_REQUEST {
      HTTP::respond 200 content {
       
            Pretend this is the web site.
            HTTP::header "True-Client-IP": [HTTP::header "X-Forwarded-For"]
         
       }
    }

Is that possible?

This is to make testing easier.

Thanks! Ben

2 Replies

  • You can definitely use evaluated expressions in an HTTP::respond command, but your example is a little off. You would include any HTTP headers AFTER the content. Example:

    when HTTP_REQUEST {
        HTTP::respond 200 content "..." "True-Client-IP" [IP::client_addr]
    }
    

    Your example assumes the X-Forwarded-For header would be in the HTTP request, which the client (a browser) would not generally send. So if you need to send the client source address back to the client, you could simply use [IP::client_addr].

  • I basically want to list the headers that F5 received, and or modified, in an HTTP::response

    Okay. Please try this then:

    when HTTP_REQUEST {
        set headerlist ""
        foreach x [HTTP::header names] {
            append headerlist "$x = [HTTP::header $x]
    "
        }
        HTTP::respond 200 content "Request Headers:
    $headerlist"
    }
    

    This will send back all of the client's request headers in formatted HTML.