BIG-IP : http profile : insert multiple headers

F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi

Via the web-admin, I can create/edit an

http profile

and set this field :

Request Header Insert = "X-Forwarded-Proto:http"

But what if I want to insert multiple headers ?

What is the syntax ?

Further, does

Request Header Insert

erase any pre-existing request headers ?

Also, I set

Insert X-Forwarded-For

to

Enabled

but logs do not show header

X-Forwarded-For

to be present.

You must use an iRule to insert more than one I believe. To do it with an iRule you can do something simple like this:

when HTTP_REQUEST {
    HTTP::header insert [list X-Forwarded-Proto http header2 value2 headerN valueN]
}

You must use an iRule to insert more than one I believe. To do it with an iRule you can do something simple like this:

when HTTP_REQUEST {
    HTTP::header insert [list X-Forwarded-Proto http header2 value2 headerN valueN]
}

https://devcentral.f5.com/wiki/iRules.HTTP__header.ashx

Thanks Brad - could you please also take a look at my amended question ?

Thanks Brad - could you please also take a look at my amended question ?

This is an old question, but I noticed (v13.1.0.5) that the GUI help for Request Header Insert specifically says that multiple headers may be inserted, but does not indicate the syntax.

“Type a string that the system inserts as a header in an HTTP request. If the header exists already, the system does not replace it. For multiple header insertions, both LTM Policies and iRules support inserting multiple headers into a request”

I’ve tried separating by spaces (as is indicated for Allowed Headers) or \n , but only the last header is inserted correctly, i.e.:

Header1:yes Header2:no

comes out on a single line as:

Header1 yes Header2=no

This is an old question, but I noticed (v13.1.0.5) that the GUI help for Request Header Insert specifically says that multiple headers may be inserted, but does not indicate the syntax.

“Type a string that the system inserts as a header in an HTTP request. If the header exists already, the system does not replace it. For multiple header insertions, both LTM Policies and iRules support inserting multiple headers into a request”

I’ve tried separating by spaces (as is indicated for Allowed Headers) or \n , but only the last header is inserted correctly, i.e.:

Header1:yes Header2:no

comes out on a single line as:

Header1 yes Header2=no

Try a semicolon as a seperator

Try a semicolon as a seperator