I need an irule to split the IP::remote_addr and just set the first IP as theX-Forwarded-For
when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::remote_addr] }
DevCentral - An F5 Technical Community Is almost there with the following but it doesn’t apply after the “foreach” line(they were trying to something different though in the end):
when HTTP_REQUEST {
if {[HTTP::header “X-Forwarded-For”] ne “”}{
log local0. "XFF: [HTTP::header "X-Forwarded-For"]"
foreach xff [split [string map [list " " ""] [HTTP::header "X-Forwarded-For"]] ","] {
log local0. "Current XFF element: $xff"
if {[IP::addr $xff equals 1.2.3.4]}{
log local0. "Sending 410 for $xff"
HTTP::respond 410
break
}
}
} }