Forum Discussion
TCP Option 28 X-Forwarded-For Header
- Feb 03, 2023
when CLIENT_DATA {
set opt28 [TCP::option get 28]
if { [string length $opt28] == 4 } {
binary scan $opt28 H8 addr
scan $addr "%2x%2x%2x%2x" ip1 ip2 ip3 ip4
set optaddr "$ip1.$ip2.$ip3.$ip4"
log local0. "optaddr is $optaddr"
log local0. "ip addr parse result is [IP::addr parse -ipv4 $opt28]"
}
}
Akamai said the IP address forwarded in TCP Option28 is in HEX format and needs to be converted back to the decimal version...
when CLIENT_DATA {
set opt28 [TCP::option get 28]
if { [string length $opt28] == 4 } {
binary scan $opt28 H8 addr
scan $addr "%2x%2x%2x%2x" ip1 ip2 ip3 ip4
set optaddr "$ip1.$ip2.$ip3.$ip4"
log local0. "optaddr is $optaddr"
log local0. "ip addr parse result is [IP::addr parse -ipv4 $opt28]"
}
}
- f5gurunotFeb 03, 2023Cirrus
Thank you!! This was the solution...
when CLIENT_DATA {
set opt28 [TCP::option get 28]
if { [string length $opt28] == 4 } {
binary scan $opt28 H8 addr
scan $addr “%2x%2x%2x%2x” ip1 ip2 ip3 ip4
set optaddr “$ip1.$ip2.$ip3.$ip4"
log local0. “optaddr is $optaddr”
log local0. “ip addr parse result is [IP::addr parse -ipv4 $opt28]”
}
}
when HTTP_REQUEST {
if { [info exists optaddr] } {
HTTP::header insert X-Forwarded-For $optaddr
}
}- xuwenFeb 04, 2023Cumulonimbus
the result of [string length [TCP::option get 28] == 0,similar to the phenomenon of using TOA moudle in nginx to read the tcp option 254(F5 in SERVER_CONNECTED event insert tcp option),
Akamai's insert tcp option 28 is in the tcp data, Akamai's technology is not powerful than F5(V14+) in SERVER_INIT event inserts three times tcp options 28 into the (tcp syn, tcp ack, tcp data) process
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com