HTTP header insertion using irules

Hi,

Need some help here, I am trying to insert a http header with value of another header in the same HTTP request, how do I do that?

E.g.

when HTTP_REQUEST { HTTP::header insert “User-Agent” [reference to another header value] }

Try this:

when HTTP_REQUEST { 
if { not (HTTP::header values  eq "") } {
set VALUE [HTTP::header values ]
HTTP::header insert "User-Agent" $VALUE
}

Hi Splendid81,

you may use the iRule code below…

when HTTP_REQUEST { 
    if { [HTTP::header values ""] ne "" } then {
         HTTP::header remove ""
        HTTP::header replace "" [HTTP::header values ""]
    }
}

Note: You may uncomment the HTTP::header remove “” line if security is a concern for you. Otherwise LTM will just replace/add a single occourence without checking if the same header name exist more than once.

Cheers, Kai