Forum Discussion
The_Bhattman
Feb 08, 2010Nimbostratus
Hi Eric,
The following is a untested iRule that may work for you
when HTTP_REQUEST {
Create the variable that will be used to later to store the IP address with the dots
set ipaddr
Scan command looks at the source address in [IP::client] and breaks it up into 4 variables oct1 to oct4
scan [IP::client] {%[^.].%[^.].%[^.].%s} oct1 oct2 oct3 oct4
append takes all the variables oct1 to oct4 and puts them together into another variable called ipaddr
append $ipaddr $oct1 $oct2 $oct3 $oct4
The command below inserts a header called TOTO with the value of what's in ipaddr
[HTTP::header] insert "TOTO" $ipaddr
}
I have made comments in the code so you understand the logic behind it
I hope this helps
Bhattman