Forum Discussion
wlepkin_98758
Apr 12, 2012Nimbostratus
string range arguments
Hi, I'm trying to capture the first x-forwarded-for header value in an http request. There's probably a more efficient way to do this, but this is what I came up with:
when HTTP_REQUEST {
...
Antony_413
Apr 13, 2012Nimbostratus
It looks like to me you are just trying to locally log the Client IP from the xForwarder for the connection. XForwarder is pertinent after the autoSNAT going to the back end server. At the front end when the dicrete ClientPC->VIP connection is made, the client IP is available there, the only case I can think of at moment is where you accept a connection on on VIP, add X-Forwarder and you bounce that connection to another VIP.
Maybe something a bit simpler could help in this case? Sorry if I'm on the wrong track, I've had to make a few assumptions on your architecture. The code below should identify the IP and if there is an xforward
when HTTP_REQUEST {
set client_addr [IP::client_addr]
set Xforward [HTTP::header values X-Forwarded-For]
if { [HTTP::header exists X-Forwarded-For] } then
{
log local0. "X-Forwarded-For exists, value = $Xforward (ClientIP=$client_addr)"
} else {
log local0. "No X-Forwarded-For exists, client addr = $client_addr"
}
}
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