Forum Discussion
jerm1020_254086
Aug 01, 2016Nimbostratus
create a new Header value manipulation iRule
create a new Header value manipulation iRule. This iRule needs to interrogate Header values and substitute the x-forwarded-for value with True-Client-IP value if available. our CDN is providing the a...
Kai_Wilke
Aug 02, 2016MVP
Hi Jerm,
you may use the iRule below to copy the
"True-Client-IP"
header information (if present) into an additional "X-Forwarded-For"
header. If the "True-Client-IP"
header is not present, the iRule would simply store the client IP address of the underlying TCP session as "X-Forwarded-For"
header value...
when HTTP_REQUEST {
Removing existing "X-Forwarded-For" headers to avoid duplications.
HTTP::header remove "X-Forwarded-For"
Check if "True-Client-IP" is present
if { [set true_client_ip [HTTP::header value "True-Client-IP"]] ne "" } then {
"True-Client-IP" header is present. Copying "True-Client-IP" value to "X-Forwarded-For"
HTTP::header insert "X-Forwarded-For" $true_client_ip
} else {
"True-Client-IP" header is not present. Setting the real client IP as "X-Forwarded-For"
HTTP::header insert "X-Forwarded-For" [getfield [IP::client_addr] "%" 1]
}
}
Cheers, Kai
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects