X-Forwarded-For Log iRule

Currently I have “Insert X-Forwarded-For” field enabled on a http-custom profile. I would like to capture the field in the F5 log.

* To enable this, I need to disable http-custom profile and use iRule to insert and log X-Forwarded-For?

* For the iRule, would this be sufficient?

when HTTP_REQUEST {

HTTP::header insert X-Forwarded-For [IP::remote_addr]

log local0. “X-Forward-IP: [IP::remote_addr]”

}

Hi Norman,

you don’t have to disable the custom HTTP Profile. You can use this iRule to log the XFF header which was set by the HTTP profile.

when HTTP_REQUEST {
    if { [HTTP::header values "X-Forwarded-For"] ne "" } {
        log local0. "X-Forwarded-For: [HTTP::header X-Forwarded-For]"
    }
}

The iRule will read the XFF value which was inserted by the HTTP profile.

KR

Daniel