jaskel_106221
Aug 27, 2007Nimbostratus
Header insertion (newbie alert)
Hey there,
So, I'm really new to iRules, and I question about a HTTP::header insert
Basically, I am looking to 'replace' the value of a custom(?) header if it exists in the current connection, or insert the header. Here is what I have with some comments:
when HTTP_REQUEST {
Check to see if the header already exists
if { [ string tolower HTTP::header] starts_with "client-"} {
If it does, remove the current header element
HTTP::header remove Client-IP
The insert our own assuring that only one element exists in the
header
HTTP::header insert Client-IP:[IP::remote_addr]
}
else {
If it doesn't already exist, insert it.
HTTP::header insert Client-IP:[IP::remote_addr]
}
}
I created a test virtual server as well to just insert the header no matter what with this code:
when HTTP_REQUEST {
Insert Client-IP:[IP::remote_addr] into
the header for each http request
HTTP::header insert Client-IP:[IP::remote_addr]
}
But, sadly, it appears that neither of these two options are actually inserting a header with:
Client-IP: ip.address.here.
into my HTTP request.
I'm sorry for the lame newbie post....but thanks for looking!
-James