Forum Discussion
Ganesh_Garg
Nimbostratus
Dec 08, 2016Actual Client IP and Proxy IP in X-Forwarded-For
We have a setup where clients are behind proxy and proxy is the src-ip for LTM, we have enabled X-Forwarded-For and we are getting Proxy-IP in the header, but now the requirement is to have actual cl...
Kai_Wilke
MVP
Dec 21, 2016Hi Ganesh,
I've just checked the provided iRule and it works for me. Please use the iRule below to troubleshoot the issue and post back the resulting logs...
when HTTP_REQUEST {
log local0.debug "Orig XFF: [HTTP::header values "X-Forwarded-For"]"
if { [set x_forwarded [HTTP::header values "X-Forwarded-For"]] ne "" } then {
HTTP::header remove "X-Forwarded-For"
HTTP::header insert "X-Forwarded-For" "[join $x_forwarded ", "], [getfield [IP::client_addr] "%" 1]"
} else {
HTTP::header insert "X-Forwarded-For" "[getfield [IP::client_addr] "%" 1]"
}
log local0.debug "New XFF: [HTTP::header values "X-Forwarded-For"]"
}
Note: Also make sure, the
option of your attached HTTP profile is set to Insert X-Forwarded-For
.disable
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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